Reputation: 3024
How do I detect when the users holds ctrl and left clicks on a button in a windows forms application?
Upvotes: 17
Views: 14215
Reputation: 12505
You need to check the value of Form.ModifierKeys to see if Control was pressed, e.g.:
btn.Click += new EventHandler(btn_Click);
private void btn_Click(object sender, EventArgs e)
{
if (Form.ModifierKeys == Keys.Control)
{
// Do Ctrl-Left Click Work
}
}
Upvotes: 46