With the DevExpress control, there are some operations that are not very convenient, according to my own need to encapsulate some of the control of the event, called when the direct binding control of the event can be
For example:
This.ComboBoxEdit.KeyDown + = Ctrlbase.comboboxedit_keydown;
This. Lookupedit.keydown +=ctrlbase.lookupedit_keydown;
This. Textedit.keydown + = Ctrlbase.textedit_keydown;
This.searchLookUpEdit.KeyDown + = Ctrlbase.searchlookupedit_keydown;
This. Memoedit.keydown + = Ctrlbase.memoedit_keydown;
1: Implement carriage return jump next control
First, the TabIndex property of the control that needs to jump is set to a continuous number, which controls the jump order, usually starting from 1.
The control is then bound to write the event, (for example) can implement a carriage return jump to the next control
2: Implement Comboboxedit, Lookupedit control ↓ key to bring up drop-down list
Only need to give comboboxedit, Lookupedit binding write good event can be achieved
3: Wrap the bound event in a class to facilitate the next call
Public classCtrlbase { Public Static voidComboboxedit_keydown (Objectsender, KeyEventArgs e) { if(E.keycode = =keys.enter) {sendkeys.send ("{TAB}"); The default method that is called when the TAB key is pressed when you press ENTER. } if(E.keycode = =keys.down) {DevExpress.XtraEditors.ComboBoxEdit combobox= Sender asDevExpress.XtraEditors.ComboBoxEdit; ComboBox. ShowPopup (); Press the ↓ key to expand the drop-down list}} Public Static voidTextedit_keydown (Objectsender, KeyEventArgs e) { if(E.keycode = =keys.enter) {sendkeys.send ("{TAB}"); } } Public Static voidLookupedit_keydown (Objectsender, KeyEventArgs e) { if(E.keycode = =keys.enter) {sendkeys.send ("{TAB}"); } if(E.keycode = =keys.down) {DevExpress.XtraEditors.LookUpEdit lookUp= Sender asDevExpress.XtraEditors.LookUpEdit; Lookup.showpopup ();//Expand drop-down list}} Public Static voidSearchlookupedit_keydown (Objectsender, KeyEventArgs e) { if(E.keycode = =keys.enter) {sendkeys.send ("{TAB}"); } } Public Static voidMemoedit_keydown (Objectsender, KeyEventArgs e) { if(E.keycode = =keys.down) {sendkeys.send ("{TAB}");//↓ Key } } }
Some quick actions for devexpress controls