To change the padding of all header cells, try this:
gvTitles.ColumnHeadersDefaultCellStyle.Padding = new Padding( 10, 0, 0, 0 );
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Can i simply change it only for the header?
(If the header text is bold, the row text is too much on the left side.)
The following doesn't work:
for (int i = 0; i < gvTitles.Rows.Count; i++)
{
gvTitles.Rows[i].DefaultCellStyle.Padding = new Padding(30, 0, 0, 0);
}
To change the padding of all header cells, try this:
gvTitles.ColumnHeadersDefaultCellStyle.Padding = new Padding( 10, 0, 0, 0 );
Hi
DataGridViewCellStyle.Padding Property
system.windows.forms.datagridviewcellstyle.padding
Best Regards.
Please click the Mark as answer button and vote as helpful if this reply solves your problem.