有没有办法让DataGridViewCheckBox单元更小?

Stu*_*wig 8 datagridview datagridviewcheckboxcell winforms

如此问题中所述,如果您希望在DataGridViewCheckBoxCell中显示复选框,则DataGridView(WinForm而不是WPF)中行的最小行高似乎为17 .任何较小的复选框都会消失!

有没有办法在DataGridView单元格中放置一个较小的复选框?

小智 3

如果您现在使用.NET 4.0,则可以使用DataGridView.RowTemplate来调整最小高度。

例如,

DataGridViewRow row = this.dataGridView1.RowTemplate;
row.DefaultCellStyle.BackColor = Color.Bisque;
row.Height = 35;
row.MinimumHeight = 20;
Run Code Online (Sandbox Code Playgroud)

然而,正如这个 MSDN 答案所证明的那样,带有复选框的行的最小高度是17 像素。似乎没有任何方法可以解决这个问题。