c# - Windows form hot keys using ALT+Key, if the same key combination with case change -


we have created windows form has 2 buttons cancel , clear. have give button text &cancel , &clear shortcut key combination alt+key. when press alt+c works cancel button. instead why won't tab between these 2 buttons in windows form, works tabbing in vb6 forms. need tab between these 2 buttons if alt+c pressed. please suggest form property or button property needs set achive this?

you can try overriding processcmdkey method. below should work if press alt, let go of alt, , press c key.

private bool altpressed; protected override bool processcmdkey(ref message msg, keys keydata) {     if (altpressed)         {             if (keydata == keys.c)             {                 this.selectnextcontrol(activecontrol, true, true, true, true);                 altpressed = false;                 return true;             }         }         if (keydata == (keys.menu | keys.alt))         {             altpressed = true;             return true;         }     return base.processcmdkey(ref msg, keydata); } 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -