LabelHorizontalAlignment: MapLayerLabelHorizontalAlignment;
The LabelHorizontalAlignment property determines horizontal alignment of a map layer label relative to the position set in the topobase.
To determine vertical position of map layer label relative to the position in the topobase, use IMapLayer.LabelVerticalAlignment.
Executing the example requires a form with the following components: the Button component named Button1, the ReportBox component named ReportBox1, and the UiErAnalyzer component named UiErAnalyzer1. UiReport1 is a data source for ReportBox1. It is also required to have a regular report with a map with displayed layer labels in the repository. This map will be a data source for UiReport1.
The example is a handler of the OnClick event for the Button1 component.
Add links to the ExtCtrls, Forms, and Map system assemblies.
Sub UserProc;
Var
regrep: IPrxReport;
sheet: IPrxSheet;
table: IPrxTable;
objects: ITabObjects;
map: IMap;
layer: IMapLayers;
label: IMapLayer;
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 collection of map layers
layer := map.Layers;
// Get layer
label := layer.FindByName("Regions");
// Change vertical position of label
label.LabelVerticalAlignment := MapLayerLabelVerticalAlignment.Bottom;
// Change horizontal position of label
label.LabelHorizontalAlignment := MapLayerLabelHorizontalAlignment.Right;
// Refresh map
map.Refresh;
End Sub UserProc;
After executing the example labels of the Regions layer are displayed below and to the right relative to the position set in the topobase.
See also: