Disabled control in a DataGridView cell

From time to time you need to show a disabled control within DataGridView control. As you might already know, a grid cell has ReadOnly property which is not useful for the case because controls still looks enabled even if they are placed in disabled cell.
The good thing is that the way to get it exists. The bad thing is that we should paint the control on our own.

There is an example of such customization on MSDN: How to: Disable Buttons in a Button Column in the Windows Forms DataGridView Control

In order to update column’s cell value related to another cell without changing selection position in a grid I implemented CurrentCellDirtyStateChanged event of the grid. The full source code you can find in my Git: http://github.com/xtrmstep/DisabledControlInDataGridView/

 




No Comments


You can leave the first : )



Leave a Reply