C# Winfrom DataGridView常用设置

2021-02-01 09:14

阅读:509

标签:oid   selectall   value   space   select   return   wpost   orm   graphics   

DataGridView常用设置

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ZB.QueueSys.Common
{
    public class DataGridViewHelper
    {
        private static DataGridViewHelper instance;
        public static DataGridViewHelper Instance
        {
            get
            {
                if (instance == null) instance = new DataGridViewHelper();
                return DataGridViewHelper.instance;
            }
        }

        public void SelectAllDgv(DataGridView dgv, string cellName, bool isChecked)
        {
            int count = dgv.Rows.Count;
            for (int i = 0; i 
        /// 重绘DataGridView
        /// 
        /// 
        /// 
        public void PaintDgv(DataGridView dgv, DataGridViewRowPostPaintEventArgs e)
        {
            try
            {
                SolidBrush b = new SolidBrush(dgv.RowHeadersDefaultCellStyle.ForeColor);
                e.Graphics.DrawString((e.RowIndex + 1).ToString(System.Globalization.CultureInfo.CurrentUICulture),
                    dgv.DefaultCellStyle.Font, b, e.RowBounds.Location.X + 5, e.RowBounds.Location.Y + 4);
            }
            catch { return; }
        }

    }
}

  

C# Winfrom DataGridView常用设置

标签:oid   selectall   value   space   select   return   wpost   orm   graphics   

原文地址:https://www.cnblogs.com/YYkun/p/11597963.html


评论


亲,登录后才可以留言!