Hi,

1.. loaded the jpg to picture box (in Size mode as Zoomed).
2. I drawn a rectangle on the picture box and taken the coordinate.
3. opens the jpg in paint and observed the coordinate (where i drawn rectangle on the picture box).
when i compare the rectangle coordinate(x and y) with paint coordinate it not the same.

I changed the Size mode to normal but the Image size is too large so it display partially. so only chance is to use zoom size mode property.

How can i achieve the same coordinates.


Thanks in advance....

If I interpret your question right, I think this causes your confusion:
The upper left coordinates of a form are (0,0)
If you have a PictureBox in it at say (50,50), and you draw in the PictureBox, the upper left coordinates of the PictureBox are (0,0).

Yes u are right when load the image in Picture box by keeping picture Size mode as Normal. but it differs when change the picture box size mode as Zoom.

Say image with size 2825x3538 and keep the picture box size mode as Normal, the image shows partially in picture box. So i changed picture box mode to zoom (to fit the System screen resolution). and coordinate miss matched when compare it with Normal mode with zoom mode.

No problem with upper left corners. but when it comes at middle or some where on the image except at the corners the coordinate get varies....

I got the Answer....

ratio = picturebox.Width/original image width

rectangle.X = value (of x)/ratio.
rectangle.Y = value (of Y)/ratio.
rectangle.Width = value (of width)/ratio.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.