简体   繁体   English

如何获得图片框内图像的当前大小

[英]How to get the current size of an image within a picturebox

I have an imagebox of which I have an image in - I am "Zoom" as the SizeMode (as seen below): 我有一个图像框,其中有一个图像-我是“缩放”为SizeMode(如下所示):

this.pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;

Now I am attempting to get the current size of the image (when it has been scaled) - not the actual size of the image. 现在,我尝试获取图像的当前大小(缩放后),而不是图像的实际大小。 For example if I do: 例如,如果我这样做:

var size = pictureBox1.Image.Size 

This returns the real dimensions of the image - not the scaled ones. 这将返回图像的实际尺寸,而不是缩放的尺寸。 How can you get the scaled size of the image? 如何获得图像的缩放大小?

我认为您正在寻找的是pictureBox1.ClientSize

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM