How to convert a CheckBox to a Toggle Button?

0
I've created a checkbox column - DataGridViewCheckBoxColumn - in the DataGridView and would like to know if it is possible, and how do I make this column become a button column enable or disable a Toggle Button ?

    
asked by anonymous 21.06.2017 / 21:19

1 answer

0

If you are using the .NET Framework library, see the code below, which will convert all% of column% to a ToggleButton :

In Visual Basic:

For Each column As DataGridViewCheckBoxColumn in SuaDataGrid.Columns
     For Each item In column.Cells
           CType(item, DataGridViewCheckBoxCell).Appearance = System.Windows.Forms.Appearance.Button
     Next
Next

In C #:

foreach (DataGridViewCheckBoxColumn column in SuaDataGrid.Columns)
{
     foreach (var i in column.Cells) {
          ((DataGridViewCheckBoxCell) i).Appearance = System.Windows.Forms.Appearance.Button;
     }
}

Sources:

Link 1 Link 2

    
23.06.2017 / 20:23