10091 : GTP ASP.NET: How can I change the font color for the column header in the grid?

Question

GTP ASP.NET: How can I change the font color for the column header in the grid?

Answer

You control this by defining the CellLayouts; same as for the the Gantt in windows forms.Set the CellLayout.HeaderBackgroundColor.

Note that in windows forms you can set Gradientcolors etc, but that is currently not supported in the asp version.

Create a named CellLayout:
      CellLayout layout=new CellLayout();
      layout.MinHeight=20;
      layout.Font=new Font(“Microsoft Sans Serif”,10);
      layout.FontColor=Color.Black;
      layout.VertAlign=StringAlignment.Center;
      layout.Name=“layout”;
      layout.HeaderBackgroundColor=SystemColors.Control;
      layout.LineRight.Use=true;
      layout.LineRight.Color=SystemColors.ControlDark;
      layout.LineTop.Use=false;
      layout.LineBottom.Use=false;
      gantt1.Grid.CellLayouts.Add(layout);

And reference it from a column:
      GridColumn idcol=gantt1.Grid.Columns.AddNew(CellType.SingleText);   
      idcol.Title=“Id”;
      idcol.LayoutName=“layoutrightjust”;
      idcol.Width=20;

 

Leave a Reply