townsma
asked on
how to scale graphicspath to match picturebox zoom
I have a picturebox on a form. I load an image into it at runtime. Then i create an array of grphicpaths to outline several shapes on the image.
But often the image needs to be stretched to fill fill the form. When this happens the pre saved graphics paths no longer line up with their corresponding shape. I am guessing that I need to scale the paths, but how do I know how much to scale them?
But often the image needs to be stretched to fill fill the form. When this happens the pre saved graphics paths no longer line up with their corresponding shape. I am guessing that I need to scale the paths, but how do I know how much to scale them?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Robert,
Thank looks exactly what I was looking for. I will try to pull the key parts, and embed it into my code, and see how it goes. Will get back to you asap.
Thanks
Thank looks exactly what I was looking for. I will try to pull the key parts, and embed it into my code, and see how it goes. Will get back to you asap.
Thanks
ASKER
Hi Robert,
You solution was just what I needed. I have a little problem with detecting mouse clicks over the shapes, but I simply divided the point.X and point.Y by the scaling factors, and it worked.
Thanks for such a clear and concise solution.
Best regards
Mark
You solution was just what I needed. I have a little problem with detecting mouse clicks over the shapes, but I simply divided the point.X and point.Y by the scaling factors, and it worked.
Thanks for such a clear and concise solution.
Best regards
Mark
ASKER
Great solution and example
Open in new window