滚动NumericUpDown

时间:2013-12-25 12:46:14

标签: c# mousewheel numericupdown

我希望在滚动NumericUpDown时触发事件。当我在NumericUpDown中时,这段代码似乎忽略了滚动:

public Form1()
{
    InitializeComponent();
    MouseWheel += new MouseEventHandler(mousewheel);
}

void mousewheel(object sender, MouseEventArgs e)
{
    System.Windows.Forms.MessageBox.Show("message");
}

1 个答案:

答案 0 :(得分:1)

    public Form1()
    {
        InitializeComponent();
        numericUpDown1.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.numericUpDown1_MouseWheel);
    }

    private void numericUpDown1_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
    {
        MessageBox.Show("hello");
    }