简体   繁体   中英

Detecting ctrl+left click on winforms application

如何检测用户何时按住Ctrl并左键单击Windows窗体应用程序中的按钮?

You need to check the value of Form.ModifierKeys to see if Control was pressed, eg:

    btn.Click += new EventHandler(btn_Click);

    private void btn_Click(object sender, EventArgs e)
    {
        if (Form.ModifierKeys == Keys.Control)
        {
            // Do Ctrl-Left Click Work
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM