您的位置:首页 > 其它

【DevExpress】gridControl常用操作

2016-03-14 14:02 330 查看
1.隐藏GroupPanel表头

设置Run Design->OptionsView->ShowGroupPanel 设置为:false

2.gridview获取当前选中行:

2.1获取当前行的索引:

int index = Convert.ToInt32(gridView1.FocusedRowHandle.ToString());
2.2获取当前选中行单元格内的值:

string d =gridView1.GetRowCellDisplayText(i,col); //i代表行号,col代表标题
string e =gridView1.GetFocusedRowCellValue("字段名");

2.3选中多行

int[] rows =GridView1.GetSelectedRows(); //选中多行
string aa=GridView1.GetRowCellDisplayText(rows[0],"列字段名").ToString();


3.gridview设定不可编辑:

将gridcontrol -->gridview
-->OptionsBehavior -->Editable=false 即可

4.设置选中行的颜色:

Run Design---->View---->Appearance----->FocusedRow------->BackColor

5.给奇偶行设置不同的颜色:

Run Design---->View---->Appearance----->OddRow------>BackColor
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: