devGridView第一列显示行号
//第一列增加行号
GridViewl.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler( GridView_CustomDrawRowIndicator);
void GridView_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
{
//第一列增加行号
if (e.Info
.IsRowIndicator)
{
//if (this.IsGroupRow(e.RowHandle) == false)
if (e.RowHandle >= 0)
{
e.Info
.DisplayText = Convert.ToInt32(e.RowHandle + 1).ToString();
}
}
}
//设置宽度
void GridView_RowCountChanged(object sender, EventArgs e)
{
//动态设置第一列的宽度
string MeasureString = String.Format("{0}WA", rptGridControl1.GridView.RowCount);
rptGridControl1.GridView.IndicatorWidth = this.rptGridControl1.CreateGraphics().MeasureString(MeasureString, new Font("宋体", 9)).ToSize().Width;
}
{
//第一列增加行号
if (e.Info
.IsRowIndicator)
{
//if (this.IsGroupRow(e.RowHandle) == false)
if (e.RowHandle >= 0)
{
e.Info
.DisplayText = Convert.ToInt32(e.RowHandle + 1).ToString();
}
}
}
//设置宽度
void GridView_RowCountChanged(object sender, EventArgs e)
{
//动态设置第一列的宽度
string MeasureString = String.Format("{0}WA", rptGridControl1.GridView.RowCount);
rptGridControl1.GridView.IndicatorWidth = this.rptGridControl1.CreateGraphics().MeasureString(MeasureString, new Font("宋体", 9)).ToSize().Width;
}