GetUsedIntervalsCount: Integer;
GetUsedIntervalsCount: integer;
The GetUsedIntervalsCount method is used to get index of scale interval by the index of interval in use.
To get the number of used scale intervals, use the ITabFormatScale.GetUsedIntervalIndex method.
To execute the example a form that contains the Button component with the Button1 identifier, the TabSheetBox component with the TabSheetBox1 identifier and the UiErAnalyzer component with the UiErAnalyzer1 identifier are required. Specify the UiErAnalyzer1 data source for the TabSheetBox1 component. Express report is used as a data source.
The example is a handler of the OnClick event for the Button1 component.
Add a link to the Drawing system assembly.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Tab: ITabSheet;
Range: ITabRange;
FormatCondition: ITabFormatCondition;
Scale: ITabFormatScale;
Begin
Tab := TabSheetBox1.Source.GetTabSheet;
Range := Tab.View.Selection.Range;
FormatCondition := Range.FormatConditions.Add;
FormatCondition.Type := TabConditionType.Scale;
Scale := FormatCondition.Details As ITabFormatScale;
// automatic forming of colors for scale intervals:
Scale.UseAutoColors := False;
// color scale type:
Scale.ScaleType := TabFormatScaleType.Linear;
// number of color scale intervals:
Scale.IntervalsCount := 4;
// colors of scale intervals:
Scale.Color(0) := GxColor.FromName("Red");
Scale.Color(1) := GxColor.FromName("Blue");
Scale.Color(2) := GxColor.FromName("Green");
Scale.Color(3) := GxColor.FromName("Yellow");
Scale.Recalc;
Debug.WriteLine("Number of used scale intervals: " + Scale.GetUsedIntervalsCount.ToString);
Debug.WriteLine("Index of visible scale interval by interval index: " + Scale.GetUsedIntervalIndex(1).ToString);
End Sub Button1OnClick;
On selecting the cell range and further clicking the button the console shows the number of used scale intervals and index of visible scale interval.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example. Use Fore.NET analogs instead of Fore components.
Add a links to the Tab, Drawing system assemblies.
Imports Prognoz.Platform.Interop.Tab;
Imports Prognoz.Platform.Interop.Drawing;
…
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
Tab: ITabSheet;
Range: ITabRange;
FormatCondition: ITabFormatCondition;
Scale: ITabFormatScale;
Gxcolor: GxColorClassClass = New GxColorClassClass();
Begin
Tab := tabSheetBoxNet1.Source.GetTabSheet();
Range := Tab.View.Selection.Range;
FormatCondition := Range.FormatConditions.Add();
FormatCondition.Type := TabConditionType.tctScale;
Scale := FormatCondition.Details As ITabFormatScale;
// automatic forming of colors for scale intervals:
Scale.UseAutoColors := False;
// color scale type:
Scale.ScaleType := TabFormatScaleType.tfstLinear;
// number of color scale intervals:
Scale.IntervalsCount := 4;
// colors of scale intervals:
Scale.Color[0] := GxColor.FromName("Red");
Scale.Color[1] := GxColor.FromName("Blue");
Scale.Color[2] := GxColor.FromName("Green");
Scale.Color[3] := GxColor.FromName("Yellow");
Scale.Recalc();
System.Diagnostics.Debug.WriteLine("Number of used scale intervals: " + Scale.GetUsedIntervalsCount.ToString());
System.Diagnostics.Debug.WriteLine("Index of visible scale interval by interval index: " + Scale.GetUsedIntervalIndex(1).ToString());
End Sub;
See also: