I want to use VB to get a picture size(height and width)?
I don't wanna use the image control or the other control.I only want to use code.thanks advance!
Printable View
I want to use VB to get a picture size(height and width)?
I don't wanna use the image control or the other control.I only want to use code.thanks advance!
Assuming you have access to the bitmap handle...
VB Code:
Type Size cx As Long cy As Long End Type Declare Function GetBitmapDimensionEx Lib "gdi32" Alias "GetBitmapDimensionEx" (ByVal hBitmap As Long, lpDimension As SIZE) As Long
Thanks!!!!
but if my picture is .jpg or .gif,can I use it in this format?
Once a gif or jpg is selected into a device context (i.e. displayed on the screen) it is converted to a bitmap by GDI and you can use the aforementioned API call againts it's handle.
If you want to get the dimensions from the file without displaying it you will need to interogate the file format....I'm afraid I do no t know the format for jpg or gif images, but it'll be documented on the net somewhere.
thank u very much!