I have a data grid view with several numeric columns which I would like to right justify in the columns. This works for the data, but the headers do not completely right justify. I assumed it was due to the sort glyphs, but it still leaves space even after disabling sort for that column in the designer. Is there any way to remove the space reserved for the glyph using the designer and completely right align the headers?
0
votes
1 Answers
0
votes
I don't know if you can move it over any more since you've alread appled the NotSortable to remove the glyph. What I have found though that seems to work is to also set a padding to the default cell style.
yourDataGridView.Columns[0].DefaultCellStyle.Padding = new Padding(0,0,2,0);
This should at least line the data up with the columnheader text better.
Of course Columns[0]
would only handle the first column so you would adjust the index as needed for your dgv.