Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image.width returns strange value

Status
Not open for further replies.

icca

Programmer
Jan 13, 2003
19
SE
Hi, I'm debugging this app in vb6.. you select a .jpg or .bmp and loads it into an image on the form. the image is not allowed to be larger than 750x450 (11250x6750 twips).

the problem is: image.width returns a larger value than the actual .jpg/.bmp size.


/icca

 
How much larger? Does it always return the same size regardless of the image that you load?

If you set .AutoSize to True and check the .ScaleMode is set to 3 (Pixels) and use the .ScaleWidth and .ScaleHeight values to get the image size, it should be correct.

- Andy.
 
i think .autosize is a picturebox property, this is an image object..

the width is about 1,76 larger than it should be..

/icca
 
sounds like you got your scalemode messed up.
A twip is 1/20 of a point, a point is 1/72 of a inch so a twip is 1440 of a inch

note both the picture box and the form have a scale mode.
If your form's scale mode is Pixel then your picturebox height and width will come back in pixels but if you use picturebox.scalewidth then it will come back in the picture box's scalemode.

also not that the picture box has a border by default thus is larger than the image if you use .WIDTH and .HEIGHT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top