//鼠标进入控件的可见部分
private void PictureBox_MouseEnter(object sender, EventArgs e)
{
this.Focus();
}
//处理鼠标滚轮//当e.Delta > 0时鼠标滚轮是向上滚动,e.Delta < 0时鼠标滚轮向下滚动。
protected override void OnMouseWheel(System.Windows.Forms.MouseEventArgs e)
{
if (e.Delta > 0)
{
if ((vScrollBar1.Value - 10) < vScrollBar1.Minimum)
{
vScrollBar1.Value = vScrollBar1.Minimum;
}
else
{
vScrollBar1.Value -=10;
}
}
else
{
if ((vScrollBar1.Value+10) > vScrollBar1.Maximum)
{
vScrollBar1.Value = vScrollBar1.Maximum;
}
else
{
vScrollBar1.Value += 10;
}
}
}