ITabFormatValues.MidValue

Syntax

MidValue: Variant;

Description

The MidValue property determines the condition, by which the minimum allowed value for cells to be formatted is set.

Example

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

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Tab: ITabSheet;
    Range: ITabRange;
    FormCond: ITabFormatCondition;
    ValFormat: ITabFormatValues;
Begin
    Tab := TabSheetBox1.Source.GetTabSheet;
    Range := Tab.View.Selection.Range;
    FormCond := Range.FormatConditions.Add;
    FormCond.Type := TabConditionType.Values;
    ValFormat := FormCond.Details As ITabFormatValues;
    //three-color gradient for cell formatting
    ValFormat.Style := TabFormatValuesStyle.ThreeColorScale;
    //set up minimum value
    ValFormat.MinValueType := TabFormatValueType.Percent;
    ValFormat.MinValue := 10;
    ValFormat.MinValueColor := GxColor.FromName("Red");
    //set up medium value
    ValFormat.MidValueType := TabFormatValueType.Percent;
    ValFormat.MidValue := 50;
    ValFormat.MidValueColor := GxColor.FromName("Blue");
    //set up maximum value
    ValFormat.MaxValueType := TabFormatValueType.Percent;
    ValFormat.MaxValue := 90;
    ValFormat.MaxValueColor := GxColor.FromName("Green");
End Sub Button1OnClick;

As a result when the button is clicked, a conditional format will be added for the selected cell range, applied to cells on the basis of their values. Formatting style is the three-color gradient.  Formatting is applied to the cells of the selected range, which values are greater than the minimum and smaller than the maximum by 10 percent.

See also:

ITabFormatValues