如何在TextBox中滚动鼠标时发生什么事? [英] How can I Write an Event that Happens when Mouse Scrolls in TextBox?
问题描述
当鼠标滚动时,我想更改TextBox的数量。我有一个滚动文本框,但我不想使用。有没有与此相关的事件?
我应该写一个TextBox事件吗?如果是,如何编写一个TextBox事件,当鼠标滚动时发生?
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 an TextBox Event? If yes, How can I write a textBox event that Happens when Mouse Scrolls?
推荐答案
MouseWheel
事件有没有:
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..
您可以通过 Intellisense
找到完整的事件列表,如下所示:
You can find the full list of events through Intellisense
like this:
输入控件的名称和点。现在看你需要的事件的下拉列表。当你写入 + =
添加新闻 Tab
两次。这将挂起事件并为其创建一个存根。
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.
这篇关于如何在TextBox中滚动鼠标时发生什么事?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!