Properties
Label Class Reference

Represents a single label on the map. More...

List of all members.

Properties

int Category [get, set]
 The index of visualization category the label belongs to.
bool IsDrawn [get]
 Gets a boolean value which indicates whether the label was drawn at the current extents of the map.
double Rotation [get, set]
 Gets or sets the angle of label rotation in degrees. Positive values set clockwise rotation, negative - counter-clockwise.
Extents ScreenExtents [get]
 Gets the extents the label occupies on the map (in pixels).
string Text [get, set]
 Gets or sets the text of the label.
bool Visible [get, set]
 Gets or sets a boolean value which indicates whether the label is visible.
double x [get, set]
 Gets or sets the horizontal position of the label in map coordinates.
double y [get, set]
 Gets or sets the vertical position of the label in map coordinates.

Detailed Description

Represents a single label on the map.

dot_inline_dotgraph_45.png

Graph description

Multipart shapes can have separate labels for every part. Each of such labels is represented by the instance of Label class. Labels added to the map can be accessed via Labels.get_Label() property. It's not recommended to store instances of this class retrieved from the map after the layer they belong to was removed.

This code demonstrate how to move the label for a shape with a given index.

 Shapefile sf = some_shapefile;
 int shapeIndex = 10;         // the index of shape we want to move
   
 // retrieving label object
 Label label = sf.Labels.get_Label(shapeIndex, 0);    // 0 - the first part
 if (label != null)
 {
     // is it currently displayed on the screen?
     Debug.Print("The label is drawn: " + label.IsDrawn.ToString());
        
     label.x += 10.0;            // let's move it to the right by 10 map units
     label.y -= 5.0;             // let's move it to the bottom by 5 map units
     label.Visible = true;       // ensure that it's visible
        
     Debug.Print("The text of the label: " + label.Text);
     map.Redraw();               // redraw is needed to see the changes of position
 }
 else {
     Debug.Print(string.Format("The chart with index {0} doesn't exists", shapeIndex));
 }
New API 4.8:
Added in version 4.8
Examples:
LabelSelection.cs.

Property Documentation

int Label.Category [get, set]

The index of visualization category the label belongs to.

The value -1 indicates that the label doesn't belong to any visualization category and default drawing options specified in the Labels class will be used for it's drawing.

Examples:
LabelSelection.cs.
bool Label.IsDrawn [get]

Gets a boolean value which indicates whether the label was drawn at the current extents of the map.

double Label.Rotation [get, set]

Gets or sets the angle of label rotation in degrees. Positive values set clockwise rotation, negative - counter-clockwise.

Gets the extents the label occupies on the map (in pixels).

In case the label wasn't drawn on the map, NULL reference will be returned.

string Label.Text [get, set]

Gets or sets the text of the label.

bool Label.Visible [get, set]

Gets or sets a boolean value which indicates whether the label is visible.

Call AxMap.Redraw() to see the effect of this property.

double Label.x [get, set]

Gets or sets the horizontal position of the label in map coordinates.

double Label.y [get, set]

Gets or sets the vertical position of the label in map coordinates.

 All Classes Files Functions Enumerations Properties Events