我想在C#的picturebox上使用鼠标滚轮缩放图像。我该怎么做?
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);
}