WinForm DataGridView 显示行号
2008-11-09 17:28
337 查看
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在RowHead内显示行号
- 为Winform程序中DataGridView控件增加自动显示行号功能
- Winform中的DatagridView显示行号
- winform让DataGridView显示行号
- WinForm DataGridView 显示行号
- DataGridView控件显示行号的正确代码及分析
- WinForm中DataGridView的快速查找及将指定行显示到第一行
- dataGridView行号显示以及datagridview中数据不发生覆盖解决方案
- DataGridView 使用comboBox列,只显示自定义列的方法(winForm)
- C#中DataGridView显示行号
- WinForm DataGridView 绑定泛型List(List<T>)/ArrayList不显示的原因和解决
- winform datagridview 不显示默认第一列 不显示未绑定列 数据源发生改变时自动更新
- [WinForm]dataGridView动态加载以本地图片显示列
- Winform技巧:在Datagridview中显示主键表的值
- DataGridView显示行号
- WinForm----DataGridview---连接数据库,以及双击一条数据,显示信息到Label控件,也可以是TextBox控件。
- C# 、Vb .Net 中 Datagridview显示行号方法。
- Winform在DataGridView中显示图片
- DataGridView显示行号