Question

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.

Était-ce utile?

La solution

Try (e.Modifiers & Keys.Control == Keys.Control) instead of (e.Modifiers==Keys.Control)

Autres conseils

Here is my suggestion:

if (e.KeyData.HasFlag(Keys.Space) && e.KeyData.HasFlag(Keys.Control))
{
    // DoSomething
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top