How to adjust picture in picturebox control
i have picturebox control in my form that SizeMode = StretchImage
when i load 50X250 picture - The picture looks too wide and Ugly
when i load 250X50 picture - the picture looks good.
how 开发者_开发技巧to fix it ?
If you don't want distortion, use SizeMode=Zoom
You will of course have horizontal or vertical bars next to your image
Use the appropriate PictureBox SizeMode:
Normal: The image is placed in the upper-left corner of the PictureBox. The image is clipped if it is larger than the PictureBox it is contained in.
StretchImage: The image within the PictureBox is stretched or shrunk to fit the size of the PictureBox.
AutoSize: The PictureBox is sized equal to the size of the image that it contains.
CenterImage: The image is displayed in the center if the PictureBox is larger than the image. If the image is larger than the PictureBox, the picture is placed in the center of the PictureBox and the outside edges are clipped.
Zoom: The size of the image is increased or decreased maintaining the size ratio.
It sounds like the PictureBox is doing exactly what it's supposed to, when using PictureBoxSizeMode.StretchImage
.
精彩评论