Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
{\rtf1\ansi\deff0\deftab720
{\pict\wmetafile8\picw557\pich762\picscalex99\picscaley98\picwgoal316\pichgoal436
010009000003260100000200170000000000050000000B0200000000050000000C02FA022D0203
0000001E00050000000C0202032F02050000000B0200000000030000001E00050000000C020203
2F02050000000B0200000000050000000B0200000000030000001E00050000000C020603320205
0000000B0200000000050000000B0200000000050000000B0200000000030000001E0005000000
0C0208033402050000000B0200000000050000000B0200000000050000000B0200000000050000
000B0200000000030000001E00050000000902000000000400000002010100050000000102FFFF
FF00040000002E01180005000000310201000000050000000C02C0020002050000000B02000000
00050000000B0200000000050000000B0200000000050000000B0200000000050000000B020000
00001200000026060F001A00FFFFFFFF000010000000C0FFFFFFC0FFFFFFC0010000800200000B
00000026060F000C004D617468547970650000800010000000FB02C0FD00000000000090010000
00020002001053796D626F6C0002040000002D01000008000000320A4A02400001000000F20017
00000026060F0024004D617468547970655555180003010103000A010315000001000B11110D02
862B220000000A00000026060F000A00FFFFFFFF01000000000010000000FB0210000700000000
00BC02000000000102022253797374656D0000040000002D01010004000000F001000004000000
2701FFFF040000002701FFFF040000002701FFFF040000002701FFFF040000002701FFFF030000
000000
}}


pich762--height
picw557--width

but here 762,557 \pichN,\picWN format but actual image is small image but i am getting 762,557 is very big image. I need the actual width and height of this image. This is Not in WPF. I need Normal Window Form only.
Posted

1 solution

What's in the RTF picw and pich tags is the actual width and height of the image in the document in pixels. It's not the displayed width and height. Those show up in the picwgoal and pichgoal tags. Then numbers after them are the desired display size but in twips, not pixels. Oh, and those values are specified as Long, not Integer.

You can find doucmentation on RTF tags
here[^].

There is no support for twips scaling in .NET. You can use the following function to convert twips to pixels on the current display device using it's DPI settings:
Private Function ConvertTwipsToPixel(ByVal lngTwips As Long, ByVal blnHorizontal As Boolean) As Long
    Const TWIPSPERINCH As Long = 1440
    Dim gr As Graphics
    gr = Me.CreateGraphics
    If blnHorizontal Then
        ConvertTwipsToPixel = CLng(lngTwips / TWIPSPERINCH * gr.DpiX)
    Else
        ConvertTwipsToPixel = CLng(lngTwips / TWIPSPERINCH * gr.DpiY)
    End If
End Function

This code was lifted from http://vbcity.com/forums/t/5030.aspx[^], and has NOT been tested.
 
Share this answer
 
Comments
nane aa 8-Feb-13 10:24am    
Thank You..Boss.. It Working...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900