DEV GridControl控件使用(CheckBox全选、操作按钮、事件处理,获取值)
1、GridControl控件使用
(1)绑定数据源
//绑定DataTable gridControl1.DataSource = DbHelper.ExecuteDataTable("SELECT * FROM dc_Log");
(2)配置显示列

(3)插入按钮列




(4)插入复选框CheckBox

(5)获取操作按钮列的值
设置按钮事件

获取当前行的值
private void repositoryItemButtonEdit1_Click(object sender, EventArgs e) { //获取点击行的索引 int RowIndex = gridView1.GetFocusedDataSourceRowIndex(); //输出值 MessageBox.Show(gridView1.GetRowCellValue(RowIndex, "LogId").ToString()); }
(6)获取CheckBox的值
设置批量操作按钮

按钮点击事件
private void simpleButton1_Click(object sender, EventArgs e) { //获取所选择的行 int[] rows = gridView1.GetSelectedRows(); foreach(int i in rows) { //输出值 MessageBox.Show(gridView1.GetRowCellValue(i, "LogId").ToString()); } }
(7)设置Dock属性
