0

For the button, how to detect whether it is ctrl + click a button, in the click event handler? I am using VS 2010 using C#.

Mwiza
  • 7,780
  • 3
  • 46
  • 42
william007
  • 17,375
  • 25
  • 118
  • 194
  • 4
    Metro? WinForms? WPF? Silverlight? Windows Phone? ASP.Net? MonoTouch? – SLaks Oct 26 '12 at 14:10
  • @Robuust - it's actually impossible to say if this is an exact duplicate since the code for WinForms and WPF are different. – JDB Oct 26 '12 at 18:21

1 Answers1

4

Are we talking about winforms, wpf or asp application? I will make a quick assumption that it's winforms, so here goes:

Form Form1;
button.Click += click;

private void click(object s, EventArgs e)
{
    if(Form1.ModifierKeys == Keys.Control)
    ... // Whatever you need here
}
NeroS
  • 1,179
  • 1
  • 12
  • 28