keypress - Press a C# Application button from keyboard -
i have sample c# application have 4 buttons this:
i want when press button respective others pressed correspondent button c# application (when window focused) , keeps being pressed simultaneously keyboard. how this? i've tried keyeventargs , keypress think i'm little bit confused.
le: , have possibility press 2 buttons simultaneously:
======================================================
edit later: can't understand. i've created new project. whole code is:
using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; namespace test3 { public partial class form1 : form { public form1() { initializecomponent(); this.keydown += form1_keydown; } private void form1_keydown(object sender, keyeventargs e) { if (e.keycode == keys.up) { messagebox.show("|"); } } } }
this whole code of new project, why isn't showing te message box when press button keybard? working letters...
according up, down, left , right arrow keys not trigger keydown event:
protected override bool processcmdkey(ref message msg, keys keydata) { switch (keydata) { case keys.right: button1.performclick(); return true; case keys.left: //... default: return base.processcmdkey(ref msg, keydata); } }
Comments
Post a Comment