110,535
社区成员
发帖
与我相关
我的任务
分享
private void DrawRowIndex(object sender, DataGridViewRowPostPaintEventArgs e)
{
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
e.RowBounds.Location.Y,
this.dataGridView.RowHeadersWidth - 4,
e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
this.dataGridView.RowHeadersDefaultCellStyle.Font,
rectangle,
this.dataGridView.RowHeadersDefaultCellStyle.ForeColor,
TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}