【发布时间】:2016-11-25 14:58:05
【问题描述】:
我有一个标准按钮,里面没有什么有趣的东西,而且一切正常:
private void Button_Click(object sender, EventArgs e)
{
//Whatever, is not important what's in it
}
问题是,当我点击一个按钮时,如果之后我按下回车键或空格键,它会像点击它一样触发按钮。
我尝试弄乱这些属性,但也无济于事。 如何以(可能)简单的方式防止这种情况发生?
回答任何需要它的人(放在按钮内):
if (e is MouseEventArgs)
{
//what you want in for the button to do
}
【问题讨论】:
-
这是 WPF 还是 WinForms?
-
@Roma 它是 WinForms
标签: c# button input keyboard click