DrawMapItemEventArgs.Stroke Property
Gets or sets the Color that specifies how the map item outline is painted.
Namespace: DevExpress.XtraMap
Assembly:
DevExpress.XtraMap.v24.1.dll
NuGet Package:
DevExpress.Win.Map
Declaration
public Color Stroke { get; set; }
Public Property Stroke As Color
Property Value
Type |
Description |
Color |
A Color value that specifies how the map item outline is painted.
|
Use the Stroke property when implementing the MapControl.DrawMapItem event.
Example
This example illustrates how to customize vector items when they are drawn on a map.
To do this, it’s necessary to handle the MapControl.DrawMapItem event and provide new values for the event arguments object.
using DevExpress.XtraMap;
namespace DrawMapItemExample {
public class MapItemFactory : DefaultMapItemFactory {
protected override void InitializeItem(MapItem item, object obj) {
base.InitializeItem(item, obj);
MapRectangle rect = item as MapRectangle;
if(rect != null) {
rect.Width = 1000;
rect.Height = 1000;
}
}
}
}
using System.Collections.Generic;
using System.Drawing;
namespace DrawMapItemExample {
public class TestDataItem {
public string Label { get; set; }
public double Lat { get; set; }
public double Lon { get; set; }
public Color Tag { get; set; }
}
public class TestData : List<TestDataItem> {
static readonly TestData instance;
static TestData() {
instance = new TestData();
instance.Add(new TestDataItem() { Lat = 14, Lon = 8, Label = "A", Tag = Color.Yellow });
instance.Add(new TestDataItem() { Lat = 4, Lon = -2, Label = "B", Tag = Color.Purple });
instance.Add(new TestDataItem() { Lat = -6, Lon = -12, Label = "C", Tag = Color.Red });
}
public static TestData Instance { get { return instance; } }
}
}
Imports Microsoft.VisualBasic
Imports System
Imports DevExpress.XtraMap
Namespace DrawMapItemExample
Public Class MapItemFactory
Inherits DefaultMapItemFactory
Protected Overrides Sub InitializeItem(ByVal item As MapItem, ByVal obj As Object)
MyBase.InitializeItem(item, obj)
Dim rect As MapRectangle = TryCast(item, MapRectangle)
If rect IsNot Nothing Then
rect.Width = 1000
rect.Height = 1000
End If
End Sub
End Class
End Namespace
Imports Microsoft.VisualBasic
Imports System.Collections.Generic
Imports System.Drawing
Namespace DrawMapItemExample
Public Class TestDataItem
Private privateLabel As String
Public Property Label() As String
Get
Return privateLabel
End Get
Set(ByVal value As String)
privateLabel = value
End Set
End Property
Private privateLat As Double
Public Property Lat() As Double
Get
Return privateLat
End Get
Set(ByVal value As Double)
privateLat = value
End Set
End Property
Private privateLon As Double
Public Property Lon() As Double
Get
Return privateLon
End Get
Set(ByVal value As Double)
privateLon = value
End Set
End Property
Private privateTag As Color
Public Property Tag() As Color
Get
Return privateTag
End Get
Set(ByVal value As Color)
privateTag = value
End Set
End Property
End Class
Public Class TestData
Inherits List(Of TestDataItem)
Private Shared ReadOnly instance_Renamed As TestData
Shared Sub New()
instance_Renamed = New TestData()
instance_Renamed.Add(New TestDataItem() With {.Lat = 14, .Lon = 8, .Label = "A", .Tag = Color.Yellow})
instance_Renamed.Add(New TestDataItem() With {.Lat = 4, .Lon = -2, .Label = "B", .Tag = Color.Purple})
instance_Renamed.Add(New TestDataItem() With {.Lat = -6, .Lon = -12, .Label = "C", .Tag = Color.Red})
End Sub
Public Shared ReadOnly Property Instance() As TestData
Get
Return instance_Renamed
End Get
End Property
End Class
End Namespace
See Also