How can I Write an Event that Happens when Mouse Scrolls in TextBox?

前端 未结 3 1936
予麋鹿
予麋鹿 2020-12-12 08:21

I wanna change the number of the TextBox when The Mouse Scrolls.
I have a Scroll TextBox But I Don\'t wanna use that. Is There any Event related to this? Should I write

相关标签:
3条回答
  • 2020-12-12 08:50

    You need MouseWheel event. Check the documentation.

    0 讨论(0)
  • 2020-12-12 08:51

    The MouseWheel event is there alright:

    public Form1()
    {
        InitializeComponent();
        textBox1.MouseWheel += textBox1_MouseWheel;
    }
    
    void textBox1_MouseWheel(object sender, MouseEventArgs e)
    {
        throw new NotImplementedException();
    }
    

    But it is not visible in the event editor. No idea why..

    You can find the full list of events through Intellisense like this:

    Enter the Control's name and a dot. Now watch the dropdownlist for the event you need. When you have it write += add press Tab twice. This hooks up the event and creates a stub for it.

    0 讨论(0)
  • 2020-12-12 09:00

    VS studio is not Intellisense becuase some properties and methods are

    [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Advanced)]

    0 讨论(0)
提交回复
热议问题