CellPadding: IGxRectF;
CellPadding: Prognoz.Platform.Interop.Drawing.GxRectF;
The CellPadding property determines the visualizer legend area, which contains items.
To determine horizontal and vertical element paddings inside the legend with intervals, use IVZIntervalsLegend.CellSpacing.
Executing the example requires a form containing the components:
ReportBox with the ReportBox1 identifier
UiReport with the UiReport1 identifier that is a data source for ReportBox1.
It is also required to have:
A regular report with a table. One of table dimensions has the Background Color metric type. The regular report is a data source for UiReport1.
The Marker.png graphic image in the root of the disc C.
Add links to the Drawing, Express, Tab, Visualizators system assemblies.
Sub UserProc;
Var
Report: IPrxReport;
TS: ITabSheet;
Grid: IEaxGrid;
Pos, CellPadPos: IGxRectF;
Visualizer: IPrxVisualizerLegend;
i: Integer;
VZLegend: IVZIntervalsLegend;
VZLegendBase: IVZLegendBase;
Color: IGxColor;
Pen: IGxPenBase;
LegItem: IVZLegendItem;
ResourceImage: IVZResourceImage;
Begin
// Get regular report
Report := UiReport1.Report;
// Get active report sheet
TS := (Report.ActiveSheet As IPrxTable) As ITabSheet;
// Insert table legend to report
Pos := New GxRectF.Create(0, 0, 0, 0);
Pos.Left := TS.View.Selection.Range.Location.X;
Pos.Top := TS.View.Selection.Range.Location.Y;
Pos.Width := TS.View.Selection.Range.Width;
Pos.Height := TS.View.Selection.Range.Height;
TS.Objects.Add("PrxVisualizerLegend", Pos);
Visualizer := TS.Objects.Item(TS.Objects.Count - 1).Extension As IPrxVisualizerLegend;
Grid := Report.DataArea.Views.Item(0) As IEaxGrid;
i := Grid.Legends.Add(Grid.IndicatorLegendAssignment(EaxGridIndicatorType.BackgroundColor));
Visualizer.SetEaxObjectLegend(Grid, EaxGridIndicatorType.BackgroundColor);
// Get table legend with intervals
VZLegend := Visualizer.PlacedControl As IVZIntervalsLegend;
VZLegendBase := VZLegend As IVZLegendBase;
// Create lines for header and footer
Color := New GxColor.CreateRGB(120, 0, 120);
Pen := New GxPen.CreateSolid(Color, 5);
VZLegendBase.HeaderLine := Pen;
VZLegendBase.Footer := VZLegendBase.Header;
VZLegendBase.FooterLine := Pen;
// Change location of objects inside tooltip and fill color
CellPadPos := New GxRectF.Create(20, 100, 100, 0);
VZLegend.CellPadding := CellPadPos;
VZLegend.ColorApplying := LegendColorApplying.Background;
VZLegend.Style.Background := New GxSolidBrush.Create(GxColor.FromName("Yellow"));
// Create a collection of legend items and add the first item to it
VZLegend.Items := New VZLegendItems.Create;
LegItem := New VZLegendItem.Create;
LegItem.Text := "TEXT";
LegItem.Color := GxColor.FromName("Blue");
VZLegend.Items.Add(LegItem);
// Align item left
VZLegend.HorizontalCellsAligment := LegendItemsHorizontalAlignment.Right;
// Create a legend marker and apply to legend item
VZLegend.Marker := New VZIntervalsLegendMarker.Create;
ResourceImage := New VZResourceImage.Create;
ResourceImage.Bitmap := New GxBitmap.CreateFromFile("C:\Marker.png");
VZLegend.Marker.Image := ResourceImage;
VZLegend.Marker.Mask := ResourceImage;
VZLegend.Marker.Marker := VisualizatorSizeMarkerShape.Custom;
// Refresh visualizer
Visualizer.Update;
End Sub UserProc;
After executing the example a map legend is created in the table cell range selected by a user. The legend has yellow background, one item aligned right, blue item marker. The marker is imported from the file.
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.
Private Sub UserProc();
Var
Report: IPrxReport;
TS: ITabSheet;
Grid: IEaxGrid;
Pos, CellPadPos: GxRectF = New GxRectFClass();
Visualizer: IPrxVisualizerLegend;
i: Integer;
VZLegend: IVZIntervalsLegend;
VZLegendBase: IVZLegendBase;
Color: GxColor = New GxColorClass_2();
ColorBack: GxColorClass = New GxColorClassClass();
Brush: GxSolidBrush = New GxSolidBrushClass();
Pen: GxPen = New GxPenClass();
LegItem: VZLegendItem = New VZLegendItemClass();
LegItems: VZLegendItems = New VZLegendItemsClass();
Marker: VZIntervalsLegendMarker = New VZIntervalsLegendMarkerClass();
ResourceImage: VZResourceImage = New VZResourceImageClass();
Bitmap: GxBitmap = New GxBitmapClass_2();
Begin
// Get regular report
Report := UiReportNet1.ReportUi.Report;
// Get active report sheet
TS := (Report.ActiveSheet As IPrxTable) As ITabSheet;
// Insert table legend to report
Pos.Create(0, 0, 0, 0);
Pos.Left := TS.View.Selection.Range.Location.X;
Pos.Top := TS.View.Selection.Range.Location.Y;
Pos.Width := TS.View.Selection.Range.Width;
Pos.Height := TS.View.Selection.Range.Height;
TS.Objects.Add("PrxVisualizerLegend", Pos);
Visualizer := TS.Objects.Item[TS.Objects.Count - 1].Extension As IPrxVisualizerLegend;
Grid := Report.DataArea.Views.Item[0] As IEaxGrid;
i := Grid.Legends.Add(Grid.IndicatorLegendAssignment[EaxGridIndicatorType.egitBackgroundColor As Integer]);
Visualizer.SetEaxObjectLegend(Grid, EaxGridIndicatorType.egitBackgroundColor As Integer);
// Get table legend with intervals
VZLegend := Visualizer.PlacedControl As IVZIntervalsLegend;
VZLegendBase := VZLegend As IVZLegendBase;
// Create lines for header and footer
Color.CreateRGB(120, 0, 120);
Pen.CreateSolid(Color, 5);
VZLegendBase.HeaderLine := Pen;
VZLegendBase.Footer := VZLegendBase.Header;
VZLegendBase.FooterLine := Pen;
// Change location of objects inside tooltip and fill color
CellPadPos.Create(20, 100, 100, 0);
VZLegend.CellPadding := CellPadPos;
VZLegend.ColorApplying := LegendColorApplying.lcaBackground;
Brush.Create(ColorBack.FromName("Yellow"));
VZLegend.Style.Background := Brush;
// Create a collection of legend items and add the first item to it
VZLegend.Items := LegItems;
LegItem.Text := "TEXT";
LegItem.Color := ColorBack.FromName("Blue");
VZLegend.Items.Add(LegItem);
// Align item left
VZLegend.HorizontalCellsAligment := LegendItemsHorizontalAlignment.lihaRight;
// Create a legend marker and apply to legend item
VZLegend.Marker := Marker;
Bitmap.CreateFromFile("C:\Marker.png");
ResourceImage.Bitmap := Bitmap;
VZLegend.Marker.Image := ResourceImage;
VZLegend.Marker.Mask := ResourceImage;
VZLegend.Marker.Marker := VisualizatorSizeMarkerShape.vsmsCustom;
// Refresh visualizer
Visualizer.Update();
End Sub UserProc;
See also: