PercentUsed: Boolean;
The PercentUsed property determines whether the number of formatted cells should be calculated as a percent of selected region.
If the property is True, the Percent of percent of selected cells are formatted, otherwise, the cells, containing the Count of maximum or minimum values, are formatted.
To execute the example a form, a button on this form named Button1, the TabSheetBox component named TabSheetBox1 and a data source for this component are required.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Tab: ITabSheet;
Range: ITabRange;
FormCond: ITabFormatCondition;
ValFormat: ITabFormatRankValues;
Style: ITabCellStyle;
Begin
Style := New TabCellStyle.Create;
Style.Font.Color := GxColor.FromName("White");
Style.BackgroundColor := GxColor.FromName("Black");
Tab := TabSheetBox1.Source.GetTabSheet;
Range := Tab.View.Selection.Range;
FormCond := Range.FormatConditions.Add;
FormCond.Type := TabConditionType.MinMax;
ValFormat := FormCond.Details As ITabFormatRankValues;
ValFormat.Percent := 15;
ValFormat.PercentUsed := True;
ValFormat.Style := Style;
ValFormat.Type := TabFormatRankType.Top;
End Sub Button1OnClick;
As a result when the button is clicked, a conditional format will be added for the selected cell range, which applies to cells with maximum or minimum values. Fifteen percent of cells, containing maximum values, will be displayed in white font on black background.
See also: