private void DGV_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
DataGridView dt = sender as DataGridView;
System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(e.RowBounds.Location.X,
e.RowBounds.Location.Y,
dt.RowHeadersWidth - 4,
e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
dt.RowHeadersDefaultCellStyle.Font,
rectangle,
dt.RowHeadersDefaultCellStyle.ForeColor,
TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
{
DataGridView dt = sender as DataGridView;
System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(e.RowBounds.Location.X,
e.RowBounds.Location.Y,
dt.RowHeadersWidth - 4,
e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
dt.RowHeadersDefaultCellStyle.Font,
rectangle,
dt.RowHeadersDefaultCellStyle.ForeColor,
TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
DGV.RowPostPaint += new DataGridViewRowPostPaintEventHandler(DGV_RowPostPaint);