I'm using WinForms. In my Form i have a picturebox
. It's sizemode is set to Zoom
. If i load an image into the picturebox
the image will zoom according to the picturebox
dimensions.
I wanted to know how I can get the size of the zoomed image inside the picturebox
.
These are some of the things i tried, but this doesn't give me the result i wanted.
private void Debug_Write_Click(object sender, EventArgs e)
{
//var pictureWidth = pictureBox1.ClientSize.Width; //This gives the size of the picturebox
//var picturewidth1 = pictureBox1.Image.Width; This gives the actual size of the image
//var pictureHight = pictureBox1.ClientSize.Height; //This gives the size of the picturebox
//var pictureHight1 = pictureBox1.ClientSize.Height; This gives the actual size of the image
Debug.WriteLine("Width: " + pictureWidth.ToString() + " Height: " + pictureHight.ToString());
}
Picturebox
size mode is set to Zoom
, so it zoomed the image depending on my picturebox
size:
How do i find out the zoomed length and width of this image?
picturebox
length: 1000 and Width is 500, and my image length: 2000 and width: 1000. When the image is loaded into thepicturebox
it will re-size it self accordingly. I want to know how to find the length and width of the image that has been re-sized to fit in thepicturebox
. @dotctor – Strephonn