dominicwong
asked on
How to grey out (or disable) column of checkboxes in datagridview (C#, Winform)
Hi experts
I have a datagridview that contains a column of checkboxes.
I would like to grey out (or disable) the column programmatically. I tried ".ReadOnly" but that only disallowed user from using it. I want to make it visually show that it is not in use.
Thanks in advance
I have a datagridview that contains a column of checkboxes.
I would like to grey out (or disable) the column programmatically. I tried ".ReadOnly" but that only disallowed user from using it. I want to make it visually show that it is not in use.
Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
unfortunately there is no easy way around the look of the checkbox. You will have to repaint the checkbox using code!
this will help u : http://www.codeproject.com/Articles/31829/Disabled-Checkbox-Column-in-the-DataGridView
hope this helps!
this will help u : http://www.codeproject.com/Articles/31829/Disabled-Checkbox-Column-in-the-DataGridView
hope this helps!
I think I provided the answer.
ASKER
Sorry masterpass. It must be an accident. I thought I'd accepted your solution with the 500 points.
Moderator, kindly please fix this mistake and give the 500 points to masterpass for his help and excellent answer.
Moderator, kindly please fix this mistake and give the 500 points to masterpass for his help and excellent answer.
ASKER
Closing this again. And thanks again to masterpass.
ASKER
I did this as I am interested in the whole column.
dgv.Columns[1].ReadOnly = true;
dgv.Columns[1].DefaultCell
It doesn't grey out the checkbox (that would be ideal), but it serves the purpose.
Do you know, by any chance, any easy mean to grey out the checkboxes too?