How to enlarge and reduce the image in the image window using the mouse wheels in C #?

I want to enlarge or reduce the image in the image using the mouse wheels in C #. How can i do

+4
source share
2 answers

This section helps to enlarge and reduce the image in the image window.

Add below code inside mouse event on mouse wheel.

if (e.Delta != 0) { if (e.Delta <= 0) { //set minimum size to zoom if (PictureBox1.Width < 50) return; } else { //set maximum size to zoom if (PictureBox1.Width > 500) return; } PictureBox1.Width += Convert.ToInt32(PictureBox1.Width * e.Delta / 1000); PictureBox1.Height += Convert.ToInt32(PictureBox1.Height * e.Delta / 1000); } 
+3
source

All Articles