IMapBackground.Image

Fore Syntax

Image: IGxImage;

Fore.NET Syntax

Image: Prognoz.Platform.Interop.Drawing.GxImage;

Description

The Image property determines an image used as a legend background.

Comments

To determine the method of image positioning as a legend background, use IMapBackground.ImageDrawStyle.

Fore Example

Executing the example requires that the repository contains a form containing the components:

It is also required to have a regular report containing a map with enabled legend that is a data source for UiReport1. The file system must have the file C:\Image.png.

Add links to the Drawing, Map, Report, Tab system assemblies.

Sub UserProc;
Var
    regrep: IPrxReport;
    sheet: IPrxSheet;
    table: IPrxTable;
    objects: ITabObjects;
    map: IMap;
    legend: IMapLegend;
    background: IMapBackground;
    image: IGxImage;
Begin
    // Get regular report
    regrep := UiReport1.Report;
    // Get map from regular report
    sheet := regrep.Activesheet;
    table := sheet As IPrxTable;
    objects := table.TabSheet.Objects;
    map := objects.Item(0).Extension As IMap;
    // Get map legend
    legend := map.View.Legend;
    // Get legend background on map
    background := legend.Background;
    // Set fill type that is image
    background.Type := MapBackgroundType.Picture;
    // Create an image from file
    Image := New GxImage.CreateFromFile("C:\Image.png");
    // Set image
    background.Image := image;
    // Set the method of image positioning that is stretch
    background.ImageDrawStyle := MapBackgroundImageDrawStyle.Stretch;
    // Refresh map
    map.Refresh;
End Sub UserProc;

After executing the example the image that is stretched to fill the entire legend area is used as a legend background.

Fore.NET Example

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.

Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Map;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;

Public
 Sub UserProc();
Var
    regrep: IPrxReport;
    sheet: IPrxSheet;
    table: IPrxTable;
    objects: ITabObjects;
    map: IMap;
    legend: IMapLegend;
    background: IMapBackground;
    image: GxImageClass_2 = New GxImageClass_2();
Begin
    // Get regular report
    regrep := UiReportNet1.ReportUi.Report;
    // Get map from regular report
    sheet := regrep.Activesheet;
    table := sheet As IPrxTable;
    objects := table.TabSheet.Objects;
    map := objects.Item[0].Extension As IMap;
    // Get map legend
    legend := map.View.Legend;
    // Get legend background on map
    background := legend.Background;
    // Set fill type that is image
    background.Type := MapBackgroundType.mbtPicture;
    // Create an image from file
    Image.CreateFromFile("C:\\Image.png");
    // Set image
    background.Image := image;
    // Set the method of image positioning that is stretch
    background.ImageDrawStyle := MapBackgroundImageDrawStyle.mbidsStretch;
    // Refresh map
    map.Refresh();
End Sub UserProc;

See also:

IMapBackground