• 大小: 0.04M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2020-12-26
  • 语言: C#
  • 标签: GridView  CheckBox  

资源简介

使用方法:

初始化这个列表头

            DatagridViewCheckBoxHeaderCell cbHeader = new DatagridViewCheckBoxHeaderCell();
            cbHeader.Value = "";
            SelectUin.HeaderCell = cbHeader;
            cbHeader.OnCheckBoxClicked  = new CheckBoxClickedHandler(cbHeader_OnCheckBoxClicked);

填写你的全选的业务逻辑

        void cbHeader_OnCheckBoxClicked(bool Status) 
        {
            for (int i = 0; i < this.dataGridView1.Rows.Count; i  )
            {
                dataGridView1.Rows[i].Cells["SelectUin"].Value = Status;
            }
        }

资源截图

代码片段和文件信息

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

namespace chbDGV
{
    public delegate void CheckBoxClickedHandler(bool state);
    public class DataGridViewCheckBoxHeaderCellEventArgs : EventArgs
    {
        bool _bChecked;
        public DataGridViewCheckBoxHeaderCellEventArgs(bool bChecked)
        {
            _bChecked = bChecked;
        }
        public bool Checked
        {
            get { return _bChecked; }
        }
    }


    class DatagridViewCheckBoxHeaderCell : DataGridViewColumnHeaderCell
    {
        Point checkBoxLocation;
        Size checkBoxSize;
        bool _checked = false;
        Point _cellLocation = new Point();
        System.Windows.Fo

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      13312  2012-07-23 09:47  chbDGV\chbDGV\bin\Debug\chbDGV.exe

     文件      30208  2012-07-23 09:47  chbDGV\chbDGV\bin\Debug\chbDGV.pdb

     文件      14328  2012-07-23 09:55  chbDGV\chbDGV\bin\Debug\chbDGV.vshost.exe

     文件        490  2009-06-11 05:14  chbDGV\chbDGV\bin\Debug\chbDGV.vshost.exe.manifest

     文件       3784  2012-07-20 18:13  chbDGV\chbDGV\chbDGV.csproj

     文件       3417  2012-07-23 10:09  chbDGV\chbDGV\DatagridViewCheckBoxHeaderCell.cs

     文件       2138  2012-07-23 10:09  chbDGV\chbDGV\Form1.cs

     文件       6170  2012-07-23 09:35  chbDGV\chbDGV\Form1.Designer.cs

     文件       6540  2012-07-23 09:35  chbDGV\chbDGV\Form1.resx

     文件        610  2012-07-23 09:55  chbDGV\chbDGV\obj\Debug\chbDGV.csproj.FileListAbsolute.txt

     文件        847  2012-07-23 09:35  chbDGV\chbDGV\obj\Debug\chbDGV.csproj.GenerateResource.Cache

     文件      13312  2012-07-23 09:47  chbDGV\chbDGV\obj\Debug\chbDGV.exe

     文件        180  2012-07-23 09:35  chbDGV\chbDGV\obj\Debug\chbDGV.frmTestDGV.resources

     文件      30208  2012-07-23 09:47  chbDGV\chbDGV\obj\Debug\chbDGV.pdb

     文件        180  2012-07-20 18:13  chbDGV\chbDGV\obj\Debug\chbDGV.Properties.Resources.resources

     文件        492  2012-07-23 09:16  chbDGV\chbDGV\Program.cs

     文件       1344  2012-07-20 17:55  chbDGV\chbDGV\Properties\AssemblyInfo.cs

     文件       2862  2012-07-20 17:55  chbDGV\chbDGV\Properties\Resources.Designer.cs

     文件       5612  2012-07-20 17:55  chbDGV\chbDGV\Properties\Resources.resx

     文件       1091  2012-07-20 17:55  chbDGV\chbDGV\Properties\Settings.Designer.cs

     文件        249  2012-07-20 17:55  chbDGV\chbDGV\Properties\Settings.settings

     文件        908  2012-07-20 17:55  chbDGV\chbDGV.sln

    ..A..H.     16896  2012-07-23 10:09  chbDGV\chbDGV.suo

     目录          0  2012-07-23 09:16  chbDGV\chbDGV\obj\Debug\Refactor

     目录          0  2012-07-20 17:55  chbDGV\chbDGV\obj\Debug\TempPE

     目录          0  2012-07-20 18:13  chbDGV\chbDGV\bin\Debug

     目录          0  2012-07-23 09:47  chbDGV\chbDGV\obj\Debug

     目录          0  2012-07-20 17:55  chbDGV\chbDGV\bin

     目录          0  2012-07-20 17:55  chbDGV\chbDGV\obj

     目录          0  2012-07-20 17:55  chbDGV\chbDGV\Properties

............此处省略5个文件信息

评论

共有 条评论