建 一個窗體名稱爲:frmAutoComplete
其它先不說,直接將GridLookUpEdit控件拖上去,其它的多餘設計,參與着可以自行拖放;
這裏就說一下這個控件怎麼就自動給提示了,找了半天才算整出來了,去看資料,杯具了,全是E文呀,後悔E文學的差撒!!!!
效果如圖:
效果就是上面的圖,樣式!
還有下拉時候那個grid的設計,是單擊gridlockEdit裏面的design進行,設計打開頁面如圖:
以上設計進行完整後,基本的配置就完了.
private void frmAutoComplete_Load(object sender, EventArgs e)
{
DataTable dt = db.getDataTable("select ID,MC,DW,DJSJ from tb_Print");
this.gridLookUpEdit1.Properties.View.OptionsBehavior.AutoPopulateColumns = false;
this.gridLookUpEdit1.Properties.DataSource = dt; //數據源
this.gridLookUpEdit1.Properties.DisplayMember = "MC"; //綁定Text顯示的字段源名稱
this.gridLookUpEdit1.Properties.ValueMember = "ID"; //綁定Value字段源名稱
this.gridLookUpEdit1.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True;
this.gridLookUpEdit1.Properties.View.BestFitColumns();
this.gridLookUpEdit1.Properties.ShowFooter = false;
this.gridLookUpEdit1.Properties.View.OptionsView.ShowAutoFilterRow = true; //顯示不顯示grid上第一個空行,也是用於檢索的應用
this.gridLookUpEdit1.Properties.AutoComplete = false;
this.gridLookUpEdit1.Properties.ImmediatePopup = true;
this.gridLookUpEdit1.Properties.PopupFilterMode = DevExpress.XtraEditors.PopupFilterMode.Contains;
this.gridLookUpEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard; //配置,用於像文本框那樣呀,可自己錄入,選擇,些處是枚舉,可自行設置.
}
以上的操作將可完成,以上的效果.
初次應用,如有那有錯的地方,朋友們提出來,一起進步!!!
謝了