我怎么能确定何时单击按钮时控制键被按下 [英] How can I determine when control key is held down during button click
本文介绍了我怎么能确定何时单击按钮时控制键被按下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎样才能确定何时控制键是在C#Windows程序按钮点击期间举行了下来?我想一个动作发生的Ctrl键/点击和另一个用于点击
How can I determine when the control key is held down during button click in a C# Windows program? I want one action to take place for Ctrl/Click and a different one for Click.
推荐答案
和多一点点:
private void button1_Click ( object sender, EventArgs e )
{
if( (ModifierKeys & Keys.Control) == Keys.Control )
{
ControlClickMethod();
}
else
{
ClickMethod();
}
}
private void ControlClickMethod()
{
MessageBox.Show( "Control is pressed" );
}
private void ClickMethod()
{
MessageBox.Show ( "Control is not pressed" );
}
这篇关于我怎么能确定何时单击按钮时控制键被按下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文