当取消选中Winforms中GridView中的一个CheckBox时,取消选中使用矩形在GridHeader上添加的CheckBox [英] Uncheck CheckBox which is added on GridHeader using rectangle when uncheck one of the CheckBox in GridView in Winforms

查看:62
本文介绍了当取消选中Winforms中GridView中的一个CheckBox时,取消选中使用矩形在GridHeader上添加的CheckBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

取消选中 CheckBox ,取消选中其中一个时,使用矩形在 GridHeader 上添加WinBox中的 GridView 中的CheckBox



我添加这样的 GridHeader 上的CheckBox

 Rectangle rect = DGVSalesDetails.GetCellDisplayRectangle(< span class =code-digit> 0 , -  1, true ); 
rect.Y = 3 ;
rect.X = rect.Location.X +(rect.Width / 8 );
CheckBox checkboxHeader = new CheckBox();
checkboxHeader.Name = checkboxHeader;
checkboxHeader.Size = new 大小( 18 18 );
checkboxHeader.Location = rect.Location;
headerCheckboxRightMargin =(rect.Width - checkboxHeader.Width)/ 2 ;
checkboxHeader.CheckedChanged + = new EventHandler(checkboxHeader_CheckedChanged);
DGVSalesDetails.Controls.Add(checkboxHeader);



我想在<时自动取消选中 CheckBox 调用code> DGVSalesDetails_CurrentCellDirtyStateChanged 。

解决方案

解决方案在codeproject中可用。:)

这个链接将解决您的问题。



切换DataGridView列内所有CheckBox的状态 [ ^ ]


问题不清楚请详细说明。

Uncheck CheckBox, which is added on GridHeader using rectangle when uncheck one of the CheckBox in GridView in Winforms.

I added CheckBox on GridHeader like this.

Rectangle rect = DGVSalesDetails.GetCellDisplayRectangle(0, -1, true);
rect.Y = 3;
rect.X = rect.Location.X + (rect.Width / 8);
CheckBox checkboxHeader = new CheckBox();
checkboxHeader.Name = "checkboxHeader";
checkboxHeader.Size = new Size(18, 18);
checkboxHeader.Location = rect.Location;
headerCheckboxRightMargin = (rect.Width - checkboxHeader.Width) / 2; 
 checkboxHeader.CheckedChanged += new EventHandler(checkboxHeader_CheckedChanged);
DGVSalesDetails.Controls.Add(checkboxHeader);


I want to uncheck this CheckBox automatically when DGVSalesDetails_CurrentCellDirtyStateChanged is called.

解决方案

Solution is available within codeproject.:)
This link will solve your problem.

Toggling the States of all CheckBoxes Inside a DataGridView Column[^]


Question not clear please elaborate more on this.


这篇关于当取消选中Winforms中GridView中的一个CheckBox时,取消选中使用矩形在GridHeader上添加的CheckBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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