|
-
May 16th, 2000, 03:04 PM
#1
Thread Starter
Member
Hi All,
I'm trying to resize a picture box to a particular size (in pixels). In theory, what I need to do is this :
Code:
Picture.Height = Picture.ScaleY(NewHeight, Picture.ScaleMode, vbPixels)
Picture.Width = Picture.ScaleX(NewWidth, Picture.ScaleMode, vbPixels)
or I should be able to multiply the NewHeight or NewWidth by Screen.TwipsPerPixelX / Y. Both give me inaccurate results!
Screen.TwipsPerPixel returns (as far as I can see) an integer (15 on my machine). Setting scaleMode to vbPixels on the picture box and manually resizing until I get a 100 pixel high box gives a 1560 high twip box. This would seem to indicate that twips per pixel is rounded (odd numbers round down remember) to the nearest integer. Is there a better way to do this??? I've tried everything I can think of to get the damn thing to work but it always seems to give me the wrong size. Any help will REALLY be appreciated!
K
-
May 18th, 2000, 12:53 AM
#2
Member
possible help...
I had the same problem once and then I read that if you change the values of .scalex or .scaley (or any .scale???) it changes the mode to user defined which totally screwed up my output (which seems to be the same thing occuring to you). The solution was to not use the .scalex, .scaley, .. but to change the values of the height, width, top, left directly. this stopped the mode from auto switching to 'user' and let the twip return the correct numbers.
hope this helped as i know it did help me.
now if i can get someone that knows about NT rights to help me we would both be happy =)
-
May 18th, 2000, 07:40 AM
#3
You're on the right track using the ScaleX, ScaleY methods, but the problem is what you're using for the From and To value for the Scaling.
A Picturebox's Width and Height is going to be measured in whatever the ScaleMode of the Parent is, so try this:
Code:
Picture1.Width = Picture1.ScaleX(NewWidthInPixels, vbPixels, Picture1.Parent.ScaleMode)
Picture1.Height = Picture1.ScaleY(NewHeightInPixels, vbPixels, Picture1.Parent.ScaleMode)
Regards,
- Aaron.
-
May 18th, 2000, 02:43 PM
#4
Thread Starter
Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|