zoukankan      html  css  js  c++  java
  • DataGridView 显示行号

    添加 RowPostPaint 事件,事件代码如下:

            private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
            {
                Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
                   e.RowBounds.Location.Y,
                   this.dataGridView1.RowHeadersWidth - 4,
                   e.RowBounds.Height);

                TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
                    this.dataGridView1.RowHeadersDefaultCellStyle.Font,
                    rectangle,
                    this.dataGridView1.RowHeadersDefaultCellStyle.ForeColor,
                    TextFormatFlags.VerticalCenter | TextFormatFlags.Right);

            }

  • 相关阅读:
    Dom对象,控制html元素
    运算符总结
    数组
    变量命名规则
    css实现气泡说明框
    深入理解CSS中的层叠上下文和层叠顺序
    jquery书写
    二级导航
    iis配置
    Android ListView无法触发ItemClick事件
  • 原文地址:https://www.cnblogs.com/todd/p/1241476.html
Copyright © 2011-2022 走看看