[SOLVED] CheckBoxes in DataGridViewRowHeaders
-
Sunday, August 05, 2012 9:58 PM
Hi,
I want to put CheckBoxes in the RowHeaders of a DataGridView, even in the column header cell of the row headers column (I mean, the cell at 0, 0). It seems that I can subclass either DataGridViewCheckBoxCell or implement IDataGridViewEditingControl, or both.
It is even possible that I would need separate classes for the header and the RowHeaders.
Besides, what I've found so far hints at drawing the cell by yourself.
Any advice on how to proceed here ??
Daniel
- Edited by dtoffe Friday, August 10, 2012 7:23 PM
All Replies
-
Monday, August 06, 2012 2:01 PM
Below link contain code to have CheckBox in ColumnHeader. You can change that code to have CheckBox in RowHeader
Gaurav Khanna | Microsoft VB.NET MVP
- Proposed As Answer by Chester HongMicrosoft Contingent Staff, Moderator Friday, August 10, 2012 9:21 AM
- Unproposed As Answer by dtoffe Friday, August 10, 2012 7:21 PM
-
Friday, August 10, 2012 7:23 PM
Thanks for your help, but this works for a standard CheckBoxColumn, what I want is to have checkboxes in the RowHeader cells. I´ll post a more specific question for this.
Thanks,
Daniel
-
Monday, August 13, 2012 7:50 AMModerator
Hi Daniel,
You have marked your thread as solved. Have you got the solution?
It is appreciated if you would like to share your solution or idea here, it will be much benificial to other community members.
According to my understanding, we can use CheckBoxRenderer to draw checkBox in RowHeaders in RowPostPaint event.
http://www.codeproject.com/Articles/201090/Row-Header-Cell-Images-in-DataGridView
http://www.codeproject.com/Articles/18929/An-OwnerDraw-ComboBox-with-CheckBoxes-in-the-Drop
The checkBox in left top cell(index is -1, -1) could be added to the controls as mentioned by Khanna, some other link:
http://www.codeproject.com/Articles/42437/Toggling-the-States-of-all-CheckBoxes-Inside-a-Dat#3
Another workaroud is to set the RowHeadersVisible property to false, and use CheckBoxCell as the above article mentioned.
Best regards,
Chester Hong
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Edited by Chester HongMicrosoft Contingent Staff, Moderator Monday, August 13, 2012 8:01 AM
-
Tuesday, August 28, 2012 7:15 PM
I'm posting my solution in this thread:
Cheers,
Daniel


