c# picturebox question [closed]
When I add an image into picturebox with C#,it does not come with actual size.
T开发者_运维问答hanks in advance.
No, by default it does not come with actual size.
It does, however, come with a manual, a careful perusal of which reveals that the key lies in setting the control's SizeMode
property to the PictureBoxSizeMode
value that you desire.
In this case, I suspect that's AutoSize
, which ensures that the picture box control is resized according to the actual size of the image that it displays.
You can set this property either in the Visual Studio designer using the Properties window, or through code using the following line in your form's constructor method:
myPictureBox.SizeMode = PictureBoxSizeMode.AutoSize;
精彩评论