Capturing Control + Shift + Enter

  • Thread starter Thread starter Vazz
  • Start date Start date
V

Vazz

I am trying to capture the key combination "Control + Shift + Enter"
in a KeyDown event. I am able capture "Control + Enter" using
(e.KeyCode == Keys.Enter && e.Modifiers == Keys.Control). How do I
check if there are two Modifiers?
 
Vazz said:
I am trying to capture the key combination "Control + Shift + Enter"
in a KeyDown event. I am able capture "Control + Enter" using
(e.KeyCode == Keys.Enter && e.Modifiers == Keys.Control). How do I
check if there are two Modifiers?

if (e.KeyCode == Keys.Enter && e.Control && e.Shift) {

}

Vadim Chekan.
 
Vadim said:
if (e.KeyCode == Keys.Enter && e.Control && e.Shift) {

}

Vadim Chekan.

Doesn't that need to be a bitwise AND?

if (e.KeyCode == (Keys.Enter & e.Control & e.Shift) )
{
}
 
Thanks guys. Its actually ((e.KeyCode == Keys.Enter) && e.Shift &&
e.Control). Works now.

Vazz
 
Tyler said:
Doesn't that need to be a bitwise AND?

if (e.KeyCode == (Keys.Enter & e.Control & e.Shift) )

No!
"Bitwize AND" of two bool variables (e.Control & e.Shift) it not wise!

Vadim Chekan.
 
Back
Top