Scaling the image with Ctrl+Mousewheel and Ctrl+ (+ / -) should be an option. I initially thought this was too hard but have realized it can be implemented with caveats. Notes:
I tested scaling the pbx and yeah, unsurprisingly onpaint does not know the scaling occurred. Thinking about it however, I think we could implement this in a fairly clever way.
PictureBox has a StretchImage mode which will automatically scale the image buffer to fit the control. However, since all our graphics code is in OnPaint, and it refers to the underlying image (via coordinates from the AsyncOCR object), it draws unscaled, because OnPaint occurs after the control has drawn the image scaled.
If, instead, we point the pbx to the 'edit' image buffer, and tell our paint routine to draw directly into that image, when the pbx renders it, all our drawn boxes and text will be scaled along with it. There are two issues:
Editing an image is slower than OnPaint, as we discovered - but unless/until we figure this out, we could simply allow scaled mode as a slow-path option and 1:1 mode as fast-path.
We need to adapt all mouse input to the scale factor, which shouldn't be that hard - if the scale factor is 50%, we literally divide the mouse position by 2 and we should be golden.
Scaling the image with Ctrl+Mousewheel and Ctrl+ (+ / -) should be an option. I initially thought this was too hard but have realized it can be implemented with caveats. Notes:
I tested scaling the pbx and yeah, unsurprisingly onpaint does not know the scaling occurred. Thinking about it however, I think we could implement this in a fairly clever way.
PictureBox has a StretchImage mode which will automatically scale the image buffer to fit the control. However, since all our graphics code is in OnPaint, and it refers to the underlying image (via coordinates from the AsyncOCR object), it draws unscaled, because OnPaint occurs after the control has drawn the image scaled.
If, instead, we point the pbx to the 'edit' image buffer, and tell our paint routine to draw directly into that image, when the pbx renders it, all our drawn boxes and text will be scaled along with it. There are two issues:
Editing an image is slower than OnPaint, as we discovered - but unless/until we figure this out, we could simply allow scaled mode as a slow-path option and 1:1 mode as fast-path.
We need to adapt all mouse input to the scale factor, which shouldn't be that hard - if the scale factor is 50%, we literally divide the mouse position by 2 and we should be golden.