c# - How to detect shift+tab when overriding ProcessCmdKey -
so had override processcmdkey in order detect tab pressing in winform. see this question context. successful in fixing tabbing issue had realize need check shift+tab logic allow user go backwards. can't seem figure out. below of have tried , hasn't worked far.
private bool istab = false; private bool isshifttab = false; private stringbuilder shifttab = new stringbuilder(); protected override bool processcmdkey(ref message msg, keys keydata) { if (keydata == keys.tab) { istab = true; shifttab.append("tab"); } else { istab = false; } if (keydata == keys.shift) { shifttab.append("shift"); } if (shifttab.tostring() == "tabshift" || shifttab.tostring() == "shifttab") { isshifttab = true; } if ((control.modifierkeys & keys.tab) != 0) { //code } return base.processcmdkey(ref msg, keydata); }
i think have combine 2 keys so:
if (keydata == (keys.shift | keys.tab)) isshifttab = true;
which can use skip tab override.
Comments
Post a Comment