-
Is there a routine or call to resize images on a form or do
I have to do the math myself? In case this isn't clear,
setting the stretch property to TRUE deforms the image.
I want to resize it to the size of my image box yet keep
the right proportions.
-
well, you could try setting something up like this:
Code:
Dim gfAspect as Single
Private Sub Form_Load()
gfAspect = (4 / 3) ' Screen proportions
End Sub
Private Sub MyResizer(fWidth as Single)
imgThePicture.Width = CLng(fWidth)
imgThePicture.Height = CLng(fWidth * (1 / gfAspect))
End Sub
I think that should work, but I'm not sure what you want though. If you just want to neatly stretch an Image control, then you can set the aspect, then alter the width and the height will sort itself out!
-
Thanks for replying. Shortly after I posted this, I went
ahead and did the math myself, doing something similar to
what you suggested. My dilema now is that changing the size
of the image and then saving it doesn't actually change
the dimensions of the saved image. I tried both with a
picture box and an image to a picture box. If I pop a msgbox
with the height and width of the image, it reflects the
modified size. But as soon as I save it, the size is back
to its original size. Any ideas?
-
Save it's Image:
Code:
SavePicture Picture1.Image FileName
-
Code:
SavePicture Picture1.Picture, "C:\MyFileName.bmp"
-
Megatron, I think that's wrong...
-
Tried that. It saves the same picture that loaded in
LoadPicture regardless of how I change the dimensions.
I also tried loading it into an image, changing dimensions,
then sticking it in an imagebox and saving it. Same deal.
-
saving it in that way doesn't change the image data, only the way it's displayed. you'll need to store the larger bitmap yourself, then paint it onto the picturebox, and save to a bmp.
-
In fact if you stretch the picture with StretchBlt you can store it's image...
-
No, Fox, it's right, trust me.
-
But you don't save the stretched or redrawn picture then... just the one you loaded into the box.
-
Fox is right meg, image is the persistent graphics, the output of a graphics method.
-
Hold on, let me try it...
Yeah, it does. I guess you were right!
-
-
-
What's with the one word replies?
-
-
-
-