ITabRange.StyleIndex

Fore Syntax

StyleIndex: Integer;

Fore.NET Syntax

StyleIndex: Integer;

Description

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

Fore Example

To execute the example a form, a button on this form named the Button1, the TabSheetBox component and the UiTabSheet component named UiTabSheet1 are required. 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.

Fore.NET Example

To execute the example a form, a button on this form named Button1, the TabSheetBoxNet component and the UiTabSheetNet component named UiTabSheetNet1 are required. UiTabSheetNet1 is the data source of TabSheetBoxNet.

    Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
    Var
        ColorClass: GxColorClassClass = New GxColorClassClass();
        TSheet: ITabSheet;
        Range: ITabRange;
        Style: TabCellStyle;
        i: Integer;
    Begin
        Style := New TabCellStyle();
        Style.Font.Color := ColorClass.FromName("Red");
        Style.Font.Bold := TriState.tsOnOption;
        Style.BackgroundColor := ColorClass.FromName("Green");
        TSheet := UiTabSheetNet1.TabSheetUi.TabSheet;
        i := TSheet.AddStyle(Style);
        Range := TSheet.View.Selection.Range;
        Range.StyleIndex := i;
    End Sub;

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

See also:

ITabRange