开发者

C# picturebox location changes when changing image

开发者 https://www.devze.com 2023-02-07 18:56 出处:网络
I have a PictureBox and when I change the image for some reason the locat开发者_如何学运维ion of the PictureBox isn\'t displayed correctly. It is displayed in the lower left corner instead of the top

I have a PictureBox and when I change the image for some reason the locat开发者_如何学运维ion of the PictureBox isn't displayed correctly. It is displayed in the lower left corner instead of the top left.

If I check the values of top, left, location etc. it is all correct. Is there something I am forgetting?

 myPictureBox.Image = image;
 myPictureBox.Location = new Point(0,0);


I think that's because the SizeMode property is set to AutoSize, try to set it to Normal.

Good luck!

0

精彩评论

暂无评论...
验证码 换一张
取 消