0条评论
还没有人评论过~
我想问一下在GridControl控件中,给每一行编个号,类似于行号的那种是怎样实现的?
是它本身自带的一个功能还是说要自己设计
private void gv_info_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
{
if (e.RowHandle >= 0)
{
e.Info.DisplayText = (e.RowHandle + 1).ToString();
}
}
private void gv_info_DataSourceChanged(object sender, EventArgs e)
{
DevExpress.XtraGrid.Views.Grid.GridView gv = (DevExpress.XtraGrid.Views.Grid.GridView)sender;
if (gv != null)
{
gv.IndicatorWidth = gv.RowCount.ToString().Length * 10;
if (gv.IndicatorWidth < 30) gv.IndicatorWidth = 30;
gv.Columns[0].Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] {
new DevExpress.XtraGrid.GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, gv.Columns[0].FieldName, "总行数:{0}")});
}
}