How can I Write an Event that Happens when Mouse Scrolls in 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 中滚动时发生的事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何编写鼠标在 TextBox 中滚动时发生的事件?


基础教程推荐
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01