让DataGridView显示行号
2007-07-29 08:27
218 查看
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
...{
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
e.RowBounds.Location.Y,
dataGridView1.RowHeadersWidth - 4,
e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
dataGridView1.RowHeadersDefaultCellStyle.Font,
rectangle,
dataGridView1.RowHeadersDefaultCellStyle.ForeColor,
TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
...{
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
e.RowBounds.Location.Y,
dataGridView1.RowHeadersWidth - 4,
e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
dataGridView1.RowHeadersDefaultCellStyle.Font,
rectangle,
dataGridView1.RowHeadersDefaultCellStyle.ForeColor,
TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
相关文章推荐
- 在DataGridView中显示行号
- C#--操作DataGridView控件详解(数据显示,更改行高行宽,交换行,自动添加行号)
- c#中dataGridView显示行号的方法
- datagridview 不显示行号的问题
- 在DataGridView中显示行号(C#)
- DataGridView显示行号
- C# DataGridView显示行号方法。
- C# DataGridView显示行号、行选中
- C# DataGridView显示行号的两种方法
- datagridview显示行号
- datagridview显示行号
- 让DataGridView显示行号
- datagridview显示行号
- DataGridView控件显示行号的正确代码
- C# 中 datagridview控件 在行标题显示行号的方法
- DataGridView初始化——添加列、添加行号、连接数据库、单击单元格在文本框中显示
- C#中DataGridView显示行号
- DataGridView显示行号的方法
- 【Winform】DataGridView在RowHead内显示行号
- DataGridView显示行号的几种方法