CodeItBetter Programming Another VB Programming Blog

How to get Dimensions of an image

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'Graphics - How to get Dimensions of an image

Option Explicit
 
'Add a Image Box to your form and set the Stretch property to False and Visible property to False.

Private Sub Form_Load()
    Image1.Picture = LoadPicture("C:\Temp\Test.gif")
    'Dimensions in Pixels
    Call MsgBox("Image Height (in Pixels): " & Image1.Height & vbCrLf & _
                "Image width  (in Pixels): " & Image1.Width, vbInformation, "Image Dimensions in Pixel")
    'Dimensions in Twips
    Call MsgBox("Image Height (in Twips): " & Image1.Height / Screen.TwipsPerPixelY & vbCrLf & _
                "Image width  (in Twips): " & Image1.Width / Screen.TwipsPerPixelX, vbInformation, "Image Dimensions in Twips")
End Sub
Filed under: Graphics Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.