HeaderStyle: IDataGridColumnHeaderStyle;
The HeaderStyle property returns the formatting style of a band or column header.
Executing the example requires a form with the Button1 button and the DataGrid component named DataGrid1. At least one column is created in the DataGrid1 component table.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Column: IDataGridColumn;
HeaderStyle: IDataGridColumnHeaderStyle;
Color1, Color2: IGxColor;
HeaderFont: IControlFont;
Begin
Column := DataGrid1.Columns.Item(0);
HeaderStyle := Column.HeaderStyle;
//Fill
Color1 := GxColor.FromName("Yellow");
Color2 := GxColor.FromName("Green");
HeaderStyle.Brush := New GxLinearGradientBrush.Create(Color1, Color2, 45);
//Font
HeaderFont := HeaderStyle.Font;
HeaderFont.Bold := True;
HeaderFont.Size := 10;
//Alignment
HeaderStyle.HorizontalAlignment := GxStringAlignment.Center;
HeaderStyle.VerticalAlignment := GxStringAlignment.Center;
End Sub Button1OnClick;
Clicking the button changes formatting style of the tables' first column header. The following parameters are set up for the header text: gradient background fill is applied, font parameters are changed, and vertical/horizontal alignment is set.
See also: