C#中找不到MouseWheel事件的解决办法
在.....Designer.cs中加入
this.pictureBox1.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseWheel);
再加入事件
void pictureBox1_MouseWheel(object sender, MouseEventArgs e) { double scale = 1; if (pictureBox1.Height > 0) { scale = (double)pictureBox1.Width / (double)pictureBox1.Height; } pictureBox1.Width += (int)(e.Delta * scale); pictureBox1.Height += e.Delta; }
作者:jinqier
出处:http://www.cnblogs.com/jinqier/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。