DevExpress control library ---- SearchLookUpEdit control, devexpress paging Control
DevExpress control library ---- SearchLookUpEdit Control
Basic data:
Public class Product {public int Id {get; set;} public string Model {get; set;} public string Name {get; set ;}} public class Entility {private static string GetChar (int number) {string [] array = new string [] {"A", "B", "C", "D ", "E", "F", "G", "H", "I"}; string result = array [number % 9]; return result ;} private static string GetName (int number) {string [] array = {"Unitch Data Collector", "MS scanner", "105SL", "TSC", "PH880 ", "MS320 portable printer", "PA700", "DSX800 computer", "HP printer"}; string result = array [number % 9]; return result ;} public static List <Product> GetProductList () {List <Product> list = new List <Product> (); for (int I = 0; I <200; I ++) {Product product = new Product () {Id = 100 + I, Model = GetChar (I) + I. toString () + "DLJ", Name = GetName (I) + I. toString ()}; list. add (product) ;}return list;} public static DataTable GetDataTable () {DataTable dt = new DataTable (); dt. columns. add ("Id", typeof (System. int32); dt. columns. add ("Model", typeof (System. string); dt. columns. add ("Name", typeof (System. string); for (int I = 0; I <200; I ++) {DataRow dr = dt. newRow (); dr ["Id"] = 100 + I; dr ["Model"] = GetChar (I) + I. toString () + "DLJ"; dr ["Name"] = GetName (I) + I. toString (); dt. rows. add (dr) ;}return dt ;}}
I. Use the SearchLookUpEdit control: whether the control is tall or not.
Bind data and add row number indexes before
private void Form3_Load(object sender, EventArgs e) { List<Product> list = Entility.GetProductList(); searchLookUpEdit1.Properties.DataSource = list; } private void searchLookUpEdit1View_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e) { if (e.RowHandle >= 0 && e.Info.IsRowIndicator) { e.Info.DisplayText = (e.RowHandle + 1).ToString(); } }
Add data columns:
Simple attributes:
// Double-click the searchLookUpEdit1.Properties drop-down list. showDropDown = ShowDropDown. doubleClick; searchLookUpEdit1.Properties. immediatePopup = true; // The searchLookUpEdit1.Properties drop-down list is displayed. textEditStyle = TextEditStyles. disableTextEditor; // This control does not allow the input of searchLookUpEdit1.Properties. nullText = ""; // clear the default value
This control has other functions. You are welcome to point it out !!