Some quick actions for devexpress controls

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.