Converting StdPicture.Width to pixels?
Posted on 2003-10-30
How can I convert StdPicture.Width to pixels? For example:
Private Sub Form_Click()
Dim pic As StdPicture
Set pic = LoadPicture("test.jpg")
MsgBox CStr(Screen.TwipsPerPixelX) + " x " + CStr(Screen.TwipsPerPixelX) '15 x 15
MsgBox CStr(pic.Width) + " x " + CStr(pic.Height) '1323 x 1323
This code reports that TwipsPerPixelX is 15 and pic.Width is 1323. The image is actually 50 pixels width. Therefore in this case I can divide 1323 by 26.46 to establish pixels?
Will this formula work on ANY platform, or is there a better formula to convert StdPicture.Width to pixels?
Or is there a better way in VB to establish an image width in pixels?