keyboard - How to get a combination of keys in c# -
how can capture ctrl + alt + k + p keys on c# form? thanks
it chord, cannot detect without memorizing having seen first keystroke of chord. works:
public partial class form1 : form { public form1() { initializecomponent(); } private bool prefixseen; protected override bool processcmdkey(ref message msg, keys keydata) { if (prefixseen) { if (keydata == (keys.alt | keys.control | keys.p)) { messagebox.show("got it!"); } prefixseen = false; return true; } if (keydata == (keys.alt | keys.control | keys.k)) { prefixseen = true; return true; } return base.processcmdkey(ref msg, keydata); } }
Comments
Post a Comment