简体   繁体   中英

I coudlnt catch ctrl+space key event in WinForm

I couldnt catch ctrl+space key event in winForm.But i wrote this code ((e.KeyCode==Keys.Space)&&(e.Modifiers==Keys.Control)) it didnt work.What is the problem?

[EDIT]sorry.problem is in another thing.It works.

尝试(e.Modifiers & Keys.Control == Keys.Control)而不是(e.Modifiers==Keys.Control)

Here is my suggestion:

if (e.KeyData.HasFlag(Keys.Space) && e.KeyData.HasFlag(Keys.Control))
{
    // DoSomething
}

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