سؤال

I want to have an event triggered when I scroll in my NumericUpDown. This code seems to ignore the scrolling when I'm inside a NumericUpDown:

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

void mousewheel(object sender, MouseEventArgs e)
{
    System.Windows.Forms.MessageBox.Show("message");
}
هل كانت مفيدة؟

المحلول

    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");
    }
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top