Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

How can i change image size in a pictureBox using the mouse wheel ?

$
0
0

In the constructor i did:

pictureBox1.MouseWheel += new MouseEventHandler(pictureBox1_MouseWheel);
pictureBox1.MouseHover += new EventHandler(pictureBox1_MouseHover);

Then the events:

void pictureBox1_MouseHover(object sender, EventArgs e)
        {
            pictureBox1.Focus();
        }

        void pictureBox1_MouseWheel(object sender, MouseEventArgs e)
        {
            if (e.Delta > 0)
            {
            }

        }

What i want is when i move the mouse wheel up it will change the image size to bigger size more and more for example each time in 25%

Only the image the pictureBox should stay in the same size.

And when i move the mouse wheel down it will change the image inside size down also each time by 25%

Like a zoom in/out

I have already in my code an image in the picturebox.


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>