You might want to look into Graphics.ScaleTransform
. The idea of arbitrary transformations as part of the rendering process isn't as all-pervasive in Windows Forms, but you could transform one image to another image via Graphics
, I believe.
Winforms version WPF ScaleTransform?
-
14-04-2022 - |
Question
I'm attempting to create something of a software zoom for an image in my Winforms application. I noticed an answer to a similar issue stating that it could be achieved with the mousewheel by using
private void image_MouseWheel(object sender, MouseWheelEventArgs e)
{
var st = (ScaleTransform)image.RenderTransform;
double zoom = e.Delta > 0 ? .2 : -.2;
st.ScaleX += zoom;
st.ScaleY += zoom;
}
That solution is exactly what I need, but it appears to be part of System.Windows.Media, which doesn't seem to be part of the Winforms architecture.
Does anyone know of a similar option for Winforms that would end up resembling this functionality? My google searches haven't turned up much :(
Thanks!
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow