Make your own free website on Tripod.com
Get Image Dimensions

Get the dimensions of any image file that can be loaded into an Image box.

Preparations

Add 1 Image Box to your form.
Set the Image Box Stretch property to false and the Visible property to false.


Form Code

Private Sub Form_Load()
    Image1.Picture = LoadPicture("c:\mypic.gif")
'You will get the image dimensions in pixels. to get them in Twips scale, remove
' the "/ Screen.TwipsPerPixelY" and "/ Screen.TwipsPerPixelX"  below.

    MsgBox "Image Height: " & Image1.Height / Screen.TwipsPerPixelY & _
" Image width: " & Image1.Width / Screen.TwipsPerPixelX
End Sub

Go Back