我想在 datagridview 中调整行标题大小时动态更改字体大小。
private void dataGridView1_RowHeightChanged(object sender, DataGridViewRowEventArgs e)
{
float width =e.Row.Height-3;
dataGridView1.RowsDefaultCellStyle.Font = new Font("Arial", width, GraphicsUnit.Pixel);
}
在浮点宽度=e.Row.Height-3 中,3 是您想要的值。我认为这很有用。