I’m using a DesktopImageViewer, which is great. But I’m also handling MouseMove (and similar events) to allow the user to manipulate the image is some ways.
Aside from swapping it out and using a Canvas and doing all the work myself, is there a way to have the viewer control transform the x, y coordinates of the events to “picture space”?
To be clear, this is very straight-forward math when it the image is being rendered 1:1. But when scaled to fit (i.e., the control size is smaller than the image), then it gets trickier, because it’s unclear what the margins are, whether they are the same across platforms, etc. At the very least, having a read-only property like ImageDrawRect would be nice.
I would use a canvas. That puts you in control of everything. You will then need to handle scaling yourself, but you’ll have all of the information you need to do what you need.