ITabRange.StyleIndex

Syntax

StyleIndex: Integer;

Description

The StyleIndex property sets a style from the collection of styles.

Example

Executing the example requires a form with the Button1 button located on it, the TabSheetBox component and the UiTabSheet component named UiTabSheet1. UiTabSheet1 is the data source for TabSheetBox.

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        TSheet: ITabSheet;
        TRange: ITabRange;
        Style: ITabCellStyle;
        i: Integer;
    Begin
        Style := New TabCellStyle.Create;
        Style.Font.Color := GxColor.FromName("Red");
        Style.Font.Bold := TriState.OnOption;
        Style.BackgroundColor := GxColor.FromName("Green");
        TSheet := UiTabSheet1.TabSheet;
        i := TSheet.AddStyle(Style);
        TRange := TSheet.View.Selection.Range;
        TRange.StyleIndex := i;
    End Sub Button1OnClick;

Clicking the button adds style to style collection. This style is applied to the selected table range.

See also:

ITabRange