Link to home
Start Free TrialLog in
Avatar of James20000
James20000

asked on

Converting StdPicture.Width to pixels?

Hello,

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
  End Sub

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?

Thanks,
James
ASKER CERTIFIED SOLUTION
Avatar of fantasy1001
fantasy1001

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Richie_Simonetti
two birds with one shoot, isn't it?
:))