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
  • 6,098
  • 3
  • 41
  • 35
william007
  • 15,661
  • 20
  • 90
  • 161
  • 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,149
  • 1
  • 12
  • 28