Wednesday 7 July, 2010

ADD INDEX NUMBERS TO EACH ROW HEADER IN A DATAGRIDVIEW

  1. private void w_Dgv_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
  2. {
  3. // Add row numbers
  4. // Taken from "Pro C# 2008 and The .NET 3.5 Platform" pp. 807-808
  5. using (var brush = new SolidBrush(Color.Black))
  6. {
  7. e.Graphics.DrawString((e.RowIndex).ToString(),
  8. e.InheritedRowStyle.Font, brush, e.RowBounds.Location.X + 15,
  9. e.RowBounds.Location.Y + 4
  10. );
  11. }
  12. }

No comments:

Post a Comment