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;
        }

 

posted on 2013-12-27 13:30  jin_qi_er  阅读(4446)  评论(0编辑  收藏  举报