[英]How to adjust picture in picturebox control
i have picturebox control in my form that SizeMode = StretchImage
我的形式有
SizeMode = StretchImage
控件, SizeMode = StretchImage
when i load 50X250 picture - The picture looks too wide and Ugly 当我加载50X250图片 - 图片看起来太宽和丑
when i load 250X50 picture - the picture looks good. 当我加载250X50图片 - 图片看起来不错。
how to fix it ? 怎么解决?
Use the appropriate PictureBox SizeMode : 使用适当的PictureBox SizeMode :
Normal: The image is placed in the upper-left corner of the PictureBox.
正常:图像位于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.
StretchImage :PictureBox中的图像被拉伸或缩小以适合PictureBox的大小。
AutoSize : The PictureBox is sized equal to the size of the image that it contains.
AutoSize :PictureBox的大小等于它包含的图像的大小。
CenterImage : The image is displayed in the center if the PictureBox is larger than the image.
CenterImage :如果PictureBox大于图像,则图像显示在中央。 If the image is larger than the PictureBox, the picture is placed in the center of the PictureBox and the outside edges are clipped.
如果图像大于PictureBox,则图片将放置在PictureBox的中心,并剪裁外边缘。
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
. 当使用
PictureBoxSizeMode.StretchImage
时,听起来像PictureBox正在做它应该做的事情。
If you don't want distortion, use SizeMode=Zoom 如果您不想要失真,请使用SizeMode = Zoom
You will of course have horizontal or vertical bars next to your image 当然,您的图像旁边会有水平或垂直条
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.