zoukankan      html  css  js  c++  java
  • 为 DataGridView 添加行号

       

     /// <summary>为 DataGridView 添加行号。</summary>
            public static void ShowRows_DataGridView_RowPostPaint(DataGridView dgv, object sender, DataGridViewRowPostPaintEventArgs e)
            {
                Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, dgv.RowHeadersWidth - 4, e.RowBounds.Height);
                TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), dgv.RowHeadersDefaultCellStyle.Font, rectangle, dgv.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
            }

    触发DataGrilView的RowPostPaint事件

       private void dgvMember_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
            {
                CommonTools.ShowRows_DataGridView_RowPostPaint(this.dgvMember, sender, e);
            }
  • 相关阅读:
    Linux
    网络
    线程池
    JVM内存结构相关知识
    JVM命令
    maven
    多线程
    AJAX、JSON
    JSP、EL、JSTL
    Mysql面试总结
  • 原文地址:https://www.cnblogs.com/shuang121/p/3134004.html
Copyright © 2011-2022 走看看