DevExpress / Grid Control - Set Column Style (Code) : Column Header Color, Column Header Font, Cell Font
private void SetColumnStyle(GridControl gc, Color clr)
{
int nWidth = 300;
GridView view = gc.MainView as GridView;
for(int nIndex = 0; nIndex < view.Columns.Count; nIndex++)
{
view.Columns[nIndex].AppearanceHeader.BackColor = clr;
view.Columns[nIndex].AppearanceHeader.Font = new Font("Verdana", 14F, FontStyle.Bold);
view.Columns[nIndex].AppearanceCell.Font = new Font("Verdana", 12F, FontStyle.Bold);
if (nIndex == 0) nWidth = 200;
else nWidth = 300;
view.Columns[nIndex].Width = nWidth;
}
}
댓글