Contains properties and references for the map Legend.
Object Model
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim instance As Legend |
Example
The following example sets some properties of the legend, draws the legend, and sets an image control to use the legend image. The example assumes an existing MapView object.
C# | Copy Code |
---|
// Create the legend and set its properties
Legend mapLegend = mapView.Legend;
mapLegend.Antialiasing = false;
mapLegend.AutoSize = true;
mapLegend.BackColor = System.Drawing.Color.Beige;
mapLegend.CanSplit = true;
mapLegend.CellSpacing = 5;
mapLegend.ColumnCount = 3;
mapLegend.FileName = "World_Legend";
mapLegend.FontName = "Verdana";
mapLegend.Height = 200;
mapLegend.LayerFontSize = 10;
mapLegend.ReverseOrder = true;
mapLegend.SplitText = "continued...";
mapLegend.SwatchHeight = 10;
mapLegend.SwatchWidth = 14;
mapLegend.TitleFontSize = 14;
mapLegend.TitleText = "Map Key";
mapLegend.TransparentColor = System.Drawing.Color.Beige;
mapLegend.ValueFontSize = 8;
mapLegend.Width = 300;
// Draw the legend and display it in an image control
CartoImage legendImage = mapLegend.Draw();
imgLegend.ImageUrl = legendImage.Url; |
Visual Basic | Copy Code |
---|
' Create the legend and set its properties
Dim mapLegend As Legend = mapView.Legend
mapLegend.Antialiasing = False
mapLegend.AutoSize = True
mapLegend.BackColor = System.Drawing.Color.Beige
mapLegend.CanSplit = True
mapLegend.CellSpacing = 5
mapLegend.ColumnCount = 3
mapLegend.FileName = "World_Legend"
mapLegend.FontName = "Verdana"
mapLegend.Height = 200
mapLegend.LayerFontSize = 10
mapLegend.ReverseOrder = True
mapLegend.SplitText = "continued..."
mapLegend.SwatchHeight = 10
mapLegend.SwatchWidth = 14
mapLegend.TitleFontSize = 14
mapLegend.TitleText = "Map Key"
mapLegend.TransparentColor = System.Drawing.Color.Beige
mapLegend.ValueFontSize = 8
mapLegend.Width = 300
' Draw the legend and display it in an image control
Dim legendImage As CartoImage = mapLegend.Draw()
imgLegend.ImageUrl = legendImage.Url |
Remarks
Requirements
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family
See Also