IDataGridStyles.Add

Syntax

Add: IDataGridStyle;

Description

The Add method adds a new style to the styles collection of the DataGrid component.

Example

Executing the example requires a form with the Button1 button and the DataGrid component named DataGrid1.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

s: IDataGridStyle;

Begin

s := DataGrid1.Styles.Add;

s.BackgroundColor := GxColor.FromName("Red");

s.Font := New GxFont.Create("Times New Roman", 14);

s.StringFormat.Alignment := GxStringAlignment.Center;

s.StringFormat.LineAlignment := GxStringAlignment.Center;

s.StringFormat.Trimming := GxStringTrimming.EllipsisWord;

s.TextColor := GxColor.FromName("Blue");

DataGrid1.Columns.Item(0).StyleIndex := 1;

End Sub Button1OnClick;

After executing the example click the button, a style is added to the styles collection and this style is set for the first column.

See also:

IDataGridStyles