//关于XtraEditors的ComboxEditor、TextboxEditor和ButtonEditor 的使用总结 //使用这三种控件必须引入using DevExpress.XtraEditors; //1、ComBoxEditor: comboBoxEdit_conditions.Properties.Items.AddRange(role);//绑定ComboxEditor 其中Role为数组 comboBoxEdit_conditions.SelectedIndex = 0;//设置默认选中的Item comboBoxEdit_conditions.Properties.ImmediatePopup = true;//按任意字母后ComboxEditor展开 comboBoxEdit_conditions.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;//设置其为只读 this.comboBoxEdit_conditions.Select();//激活控件 同样适用于其他控件 this.comboBoxEdit_conditions.Focus();//设置可编辑焦点 同上 this.comboBoxEdit_conditions.ShowPopup();//使ComboxEditor展开 //2、TextboxEditor: this.textEdit_ByCode.Select(); this.textEdit_ByCode.Focus(); this.textEdit_ByCode.SelectAll();//选中Editor区域的所有文本 //3、ButtonEditor: this.buttonEdit_Input.Location = new System.Drawing.Point(136, 29); this.buttonEdit_Input.Name = "buttonEdit_Input"; this.buttonEdit_Input.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton()}); //添加EditorButton(外观是方框三点Eillips) this.buttonEdit_Input.Properties.Mask.EditMask = "//d{6}//|//d{6}//|//w{2,3}";//正则表达式 this.buttonEdit_Input.Properties.Mask.IgnoreMaskBlank = false; this.buttonEdit_Input.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx;//正则类型 this.buttonEdit_Input.Properties.Mask.UseMaskAsDisplayFormat = true; this.buttonEdit_Input.Size = new System.Drawing.Size(168, 21); this.buttonEdit_Input.TabIndex = 0; this.buttonEdit_Input.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.buttonEdit_Input_KeyPress); this.buttonEdit_Input.ButtonPressed += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(this.buttonEdit_Input_ButtonPressed);//ButtonEditor的按钮事件