csharp datagridview set column header alignment

Code Example - csharp datagridview set column header alignment

                
                        foreach(DataGridViewColumn col in dgvBreakDowns.Columns)
{
    col.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
    col.HeaderCell.Style.Font = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Pixel);
}
                    
                
 

csharp datagridview change column alignment

                        
                                dataGridView1.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;