MidValueColor: IGxColor;
The MidValueColor property sets middle color for the gradient or histogram color depending on the formatting style currently applied to cells.
The purpose of this property depends on value of the Style property:
If the Style = TabFormatValuesStyle.ThreeColorScale, this property determines middle color of the gradient.
If the Style = TabFormatValuesStyle.DataBar, this property determines histogram color.
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: 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;
//setting minimum value
ValFormat.MinValueType := TabFormatValueType.Percent;
ValFormat.MinValue := 10;
ValFormat.MinValueColor := GxColor.FromName("Red");
//setting middle value
ValFormat.MidValueType := TabFormatValueType.Percent;
ValFormat.MidValue := 50;
ValFormat.MidValueColor := GxColor.FromName("Blue");
//setting 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: