标签:send sea pre 开始 handle group val ring enc
1.分组
在Column中将要分组的行设置GroupIndex=0,1,2...
不启用置为-1
2.设置组行字体
在GridView的GroupRow等与Group有关的Appreaence中设置
3.设置组行的选中颜色
添加事件
private void gridViewStu_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
{
DevExpress.XtraGrid.Views.Grid.GridView view = (DevExpress.XtraGrid.Views.Grid.GridView)sender;
if (e.RowHandle == view.FocusedRowHandle)
{
e.Appearance.BackColor = Color.FromArgb(216, 222, 238);
}
}
4.怎么获得选中组行数据
组行的rowhandle总是小于0的
string value = gridViewStu.GetGroupRowValue(rowHandle).ToString();
5.组行的层次
对应一开始的GroupIndex,层次从0开始设置了多少个GroupIndex就有多少个层次
判断当前组行在第几层:int level = gridViewStu.GetRowLevel(rowHandle);
6.获得当前层次的上一层数据
rowHandle是当前层的行号
获得前一层数据方法:string value = gridViewStu.GetGroupRowValue(rowHandle+1).ToString();
获得上一层方法:
int level = gridViewStu.GetRowLevel(rowHandle);
string value=(level-1,rowhandle);
private string FindLastLevelText(int level, int rowHandle)
{
int index = gridViewStu.GetRowLevel(rowHandle);
if (index == level)
{
return gridViewStu.GetGroupRowValue(rowHandle).ToString();
}
return FindLastLevelText(level, rowHandle + 1);
}
7.如何将层全部展开或收起
gridViewStu.ExpandAllGroups();//展开
gridViewStu.CollapseAllGroups();//收起
标签:send sea pre 开始 handle group val ring enc
原文地址:https://www.cnblogs.com/mhsl/p/10044769.html