.net - How To Make My Form Respond to Ctrl-Alt, in C#? -
i have simple form in c#, has grid , several buttons.
i want form change gui bit, when ctrl-alt pressed, , have gui reverted original when ctrl-alt released.
i know how check if ctrl+alt pressed - 1 way via control.modifierkeys.
what ask this:
for button press, have event handler respond it. keyboard regular keys have event handler respond it. ctrl-alt not regular key - not raise event when pressed.
so should do?
one way thought about, enable timer run, , check every 200ms if ctrl-alt pressed.
is there better way timer?
thank you
you can override form's method pick keystroke.
protected override bool processcmdkey(ref message msg, keys keydata) { if (keydata == (keys.control | keys.alt ) { //do stuff here } return base.processcmdkey(ref msg,keydata); }
Comments
Post a Comment