为datagridView添加行号
2008-07-04 17:12
309 查看
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { Color color = dataGridView1.RowHeadersDefaultCellStyle.ForeColor; if (dataGridView1.Rows[e.RowIndex].Selected) color = dataGridView1.RowHeadersDefaultCellStyle.SelectionForeColor; else color = dataGridView1.RowHeadersDefaultCellStyle.ForeColor; using (SolidBrush b = new SolidBrush(color)) { e.Graphics.DrawString((e.RowIndex+1).ToString(), e.InheritedRowStyle.Font, b, e.RowBounds.Location.X+20, e.RowBounds.Location.Y+6); } }
相关文章推荐
- 在DataGridView中添加行号
- 为DataGridView添加行号
- datagridview添加行号
- DataGridView 添加行号
- 在DataGridView中添加行号
- 在DataGridView中添加行号
- C#的DataGridView中自动在行首添加行号
- C#----给DataGridView添加行号
- DataGridView中添加行号
- 为DataGridView添加行号
- DataGridView添加行号
- Winform 程序中DataGridView 控件添加行号
- c# 在DataGridView中添加行号
- 为DataGridView添加行号
- dataGridView添加行号
- C# DataGridView 控件添加行号
- DataGridView添加行号
- DataGridView添加行号
- 为DataGridView添加行号
- C#--操作DataGridView控件详解(数据显示,更改行高行宽,交换行,自动添加行号)