B
Bruce Schechter
I have a question about how to format the display of a JPEG image in a
PictureBox control. My current code is the fullowing....
Image image = Image.FromFile( strFileName );
pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox.Image = image;
The images are loaded dynamically, and I do not have control of the size and
aspect ratio of the images. With the StretchImage mode selected, I get
some strange stretching (either vertically or horizontally, when the aspect
ratio of the image is noticably different from the aspect ratio of the
PictureBox.)
What mechanism can I use to effectively resize the image myself before
displaying it in the PictureBox? As yet I'm unable to find either a method
on the Image class or on the PictureBox class to resize the image before
display. I'd like to be able to adjust it to either fit snug vertically or
horizontally depending on respective aspect ratios.
Thanks,
and Cheers,
-- Bruce
PictureBox control. My current code is the fullowing....
Image image = Image.FromFile( strFileName );
pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox.Image = image;
The images are loaded dynamically, and I do not have control of the size and
aspect ratio of the images. With the StretchImage mode selected, I get
some strange stretching (either vertically or horizontally, when the aspect
ratio of the image is noticably different from the aspect ratio of the
PictureBox.)
What mechanism can I use to effectively resize the image myself before
displaying it in the PictureBox? As yet I'm unable to find either a method
on the Image class or on the PictureBox class to resize the image before
display. I'd like to be able to adjust it to either fit snug vertically or
horizontally depending on respective aspect ratios.
Thanks,
and Cheers,
-- Bruce