I need to be able to take a point on an image and convert it into a point relative to a picturebox with the pictureSizeMode set to zoom
here is the code that the picturebox uses to scale and center the image
Size size = this.image.Size; float num = Math.Min((float)(((float)base.ClientRectangle.Width) / ((float)size.Width)), (float)(((float)base.ClientRectangle.Height) / ((float)size.Height))); rectangle.Width = (int)(size.Width * num); rectangle.Height = (int)(size.Height * num); rectangle.X = (base.ClientRectangle.Width - rectangle.Width) / 2; rectangle.Y = (base.ClientRectangle.Height - rectangle.Height) / 2; return rectangle;
I realize this returns a rectangle, but I need it to accept a point for example 0,0 on an image, if the image was tall it would be scaled by height so the the Y would stay 0 but if the image was say 359px wide and the picuture box was 417 pixles wide the point would go from 0,0 to 35,0.
I can get it to work so long as I use 0,0 but if I need other points I cant seem to make it happen. I'm not very good a geometry.
Any help would be appreciated.