WinForm DataGridView 显示行号
2012-10-10 09:32
357 查看
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
e.RowBounds.Location.Y,
dataGridView1.RowHeadersWidth,
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,
e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
dataGridView1.RowHeadersDefaultCellStyle.Font,
rectangle,
dataGridView1.RowHeadersDefaultCellStyle.ForeColor,
TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
相关文章推荐
- winForm中让DataGridView显示行号,去除空记录行
- WinForm DataGridView 显示行号
- 【Winform】DataGridView在RowHead内显示行号
- 为Winform程序中DataGridView控件增加自动显示行号功能
- winform让DataGridView显示行号
- Winform中的DatagridView显示行号
- c#——Winform DatagridView上显示下拉树
- DataGridView控件显示行号的正确代码
- 在Winform的DataGridView的单元格中同时显示文本和图标,以及树形结构的示例
- DataGridView显示行号
- WinForm中双击dataGridView的一行将其显示到另一个窗体的控件中
- 关于WinForm中的DataGridView控件显示数据字典的解决方案。
- C#Winform基础 显示datagridview有多少行,有多少列
- C# Winform DataGridView中利用WebClient异步加载显示网络图片
- C# Winform datagridview中的数据不能显示,单击后才能显示出来
- DataGridView显示行号的方法
- C# DataGridView显示行号方法。
- datagridview 显示行号、插入多行、删除、插入、清空行
- 关于WinForm中的DataGridView控件显示数据字典的解决方案。
- [WinForm]- 设置DataGridView单元格内根据不同值显示图片