How can I right-align text in a DataGridView column? I am writing a .NET WinForms application.
I know this is old, but for those surfing this question, the answer by MUG4N will align all columns that use the same defaultcellstyle. I'm not using autogeneratecolumns so that is not acceptable. Instead I used:
e.Column.DefaultCellStyle = new DataGridViewCellStyle(e.Column.DefaultCellStyle);
e.Column.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
In this case e
is from:
Grd_ColumnAdded(object sender, DataGridViewColumnEventArgs e)