Search code examples
winformsdatagridviewdatagridviewcheckboxcell

Is there a way to make DataGridViewCheckBox Cells smaller?


As described in this question it appears the minimum row height for a row in a DataGridView (WinForm not WPF) is 17 if you wish to display check boxes in a DataGridViewCheckBoxCell. Any smaller and the check box simply disappears!

Is there a way to place a smaller checkbox in a DataGridView cell?


Solution

  • If you are now using .NET 4.0, you can use the DataGridView.RowTemplate to adjust the minimum height.

    For example,

    DataGridViewRow row = this.dataGridView1.RowTemplate;
    row.DefaultCellStyle.BackColor = Color.Bisque;
    row.Height = 35;
    row.MinimumHeight = 20;
    

    However, as evidenced by this MSDN answer the minimum height for a row with check boxes is 17 pixels. It does not appear there is any way around this problem.