user1548103
user1548103

Reputation: 869

Winforms version WPF ScaleTransform?

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!

Upvotes: 0

Views: 701

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1499730

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.

Upvotes: 1

Related Questions