C# - 我怎么prevent鼠标滚轮滚动在我的组合框? [英] C# - how do I prevent mousewheel-scrolling in my combobox?
本文介绍了C# - 我怎么prevent鼠标滚轮滚动在我的组合框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个组合框,我想prevent用户从通过与鼠标滚轮的滚动项目
I have a combobox and I want to prevent the user from scrolling through the items with the mousewheel.
有没有一种简单的方法来做到这一点?
Is there an easy way to do that?
(C#,VS2008)
(C#, VS2008)
推荐答案
使用的<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.control.mousewheel.aspx\">MouseWheel事件的组合框:
void comboBox1_MouseWheel(object sender, MouseEventArgs e) {
((HandledMouseEventArgs)e).Handled = true;
}
请注意:你必须创建code事件:
Note: you'll have to create event in code:
comboBox1.MouseWheel += new MouseEventHandler(comboBox1_MouseWheel);
这篇关于C# - 我怎么prevent鼠标滚轮滚动在我的组合框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文