所有复选框都被选中,然后Datagridview headerCheckbox将被选中,其中一个未被选中,然后标题将不被选中 [英] All check boxes are checked then Datagridview headerCheckbox will be checked and among them one is unchecked then header will be unchecked

查看:55
本文介绍了所有复选框都被选中,然后Datagridview headerCheckbox将被选中,其中一个未被选中,然后标题将不被选中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好......
我有一个datagridview,其中有一个复选框列,并且我添加了一个标题复选框.
我添加标题复选框和复选框列的代码是
DataGridViewCheckBoxColumn c1;
CheckBox ckBox;
私有void CheckboxSelect_Load(对象发送者,EventArgs e)
{
c1 = new DataGridViewCheckBoxColumn();

c1.Name =选择";

c1.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;

this.dgvSelectAll.Columns.Add(c1);

this.dgvSelectAll.Rows.Add();

this.dgvSelectAll.Rows.Add();

this.dgvSelectAll.Rows.Add();

this.dgvSelectAll.Rows.Add();

ckBox = new CheckBox();

矩形rect = this.dgvSelectAll.GetCellDisplayRectangle(0,-1,true);

ckBox.Size = new Size(18,18);

ckBox.Location = rect.Location;

this.dgvSelectAll.Controls.Add(ckBox);
}

是否有可能,如果选中了所有"复选框,则将选中标题复选框",而其中的选中的复选框"中的一个未被选中,则标题将未被选中??

谢谢您

Hi Everyone....
I have a datagridview where one checkbox column is there and i have added a header checkbox.
My code for adding a header checkbox and checkbox column is
DataGridViewCheckBoxColumn c1;
CheckBox ckBox;
private void CheckboxSelect_Load(object sender, EventArgs e)
{
c1 = new DataGridViewCheckBoxColumn();

c1.Name = "selection";

c1.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;

this.dgvSelectAll.Columns.Add(c1);

this.dgvSelectAll.Rows.Add();

this.dgvSelectAll.Rows.Add();

this.dgvSelectAll.Rows.Add();

this.dgvSelectAll.Rows.Add();

ckBox = new CheckBox();

Rectangle rect =this.dgvSelectAll.GetCellDisplayRectangle(0, -1, true);

ckBox.Size = new Size(18, 18);

ckBox.Location = rect.Location;

this.dgvSelectAll.Controls.Add(ckBox);
}

Is it possible If All check boxes are checked then header Checkbox will be checked and among them (Selected Check boxes)one is unchecked then header will be unchecked ??

Thank You

推荐答案

^ ]


这篇关于所有复选框都被选中,然后Datagridview headerCheckbox将被选中,其中一个未被选中,然后标题将不被选中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆