Skip to main content

MapControl.DrawMapItem Event

Provides the capability to custom paint map items.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v24.2.dll

Declaration

public event DrawMapItemEventHandler DrawMapItem

Event Data

The DrawMapItem event's data class is DrawMapItemEventArgs. The following properties provide information specific to this event:

Property Description
Fill Gets or sets the color that is used to fill a map item when the MapControl.DrawMapItem event is fired.
IsHighlighted Gets a value that indicates whether a map item is highlighted.
IsSelected Gets a value that indicates whether a map item is selected.
Item Gets a map item to be represented in the map control. Inherited from MapItemEventArgs.
Layer Gets an object representing a map items layer when handling the MapControl.DrawMapItem event.
Stroke Gets or sets the Color that specifies how the map item outline is painted.
StrokeWidth Gets or sets a value that specifies the width of the stroke on the current map item.

Remarks

Use the DrawMapItem event to create a custom appearance for map items.

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;
            }
        }
    }
}
See Also