HeaderStyle: IDataGridColumnHeaderStyle;
The HeaderStyle property returns a formatting style of a container or column header.
Executing the example requires a form with the Button1 button and the DataGrid component named DataGrid1. Minimum 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;
On clicking the button formatting style of the tables' first column header is changed. 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: