zoukankan      html  css  js  c++  java
  • 15.9 DataGridView绘制行号

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace _15._9DataGridView绘制行序号
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                // TODO: 这行代码将数据加载到表“csharpzxwDataSet.mytable001”中。您可以根据需要移动或删除它。
                this.mytable001TableAdapter.Fill(this.csharpzxwDataSet.mytable001);
    
            }
    
            private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
            {
                Rectangle myrec = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, dataGridView1.RowHeadersWidth-5, e.RowBounds.Height);
                TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), dataGridView1.RowHeadersDefaultCellStyle.Font, myrec, dataGridView1.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
    
            }
        }
    }
  • 相关阅读:
    状压DP之排列perm
    CodeForces 578F Mirror Box
    Berlekamp-Massey算法
    图解git操作
    yapi安装
    springcloud gateway
    springcloud alibaba
    反射和内置方法
    绑定方法与非绑定方法
    多态性和鸭子类型
  • 原文地址:https://www.cnblogs.com/zqyo2000z/p/5410159.html
Copyright © 2011-2022 走看看