Back to Devexpress

Map Overlay Items

windowsforms-115026-controls-and-libraries-map-control-visual-elements-map-overlay-items.md

latest4.0 KB
Original Source

Map Overlay Items

  • May 26, 2023
  • 3 minutes to read

The map overlay items are containers that allow you to provide a content that should be displayed over the map using Map Overlays.

This topic consists of the following sections.

Overview

There are two types of map items.

  • Image Items allow you to display images over the map. The following image demonstrates a map overlay with an image item. These items are represented by the MapOverlayImageItem class.

  • Text Items allow you to display text over the map. The following image demonstrates a map overlay with a text item.

Overlay Item Layout

For overlay items of all types their layout can be customized. At the first, overlay items can be arranged automatically. For this, specify the MapOverlayItemBase.Alignment property to align items. If several items have the same alignment, the MapOverlayItemBase.JoiningOrientation property configures how to stack items. The following table demonstrates this property in action.

Important

The MapOverlayItemBase.JoiningOrientation specifies how the item will be joined to the previously arranged items. In this way, the property shoud be specified to the stacking object.

The Property ValueThe Resulting Image
JoiningOrientation = Horizontal
JoiningOrientation = Vertical

If it is required to locate an item to the specific position with specific size manually, configure the MapOverlayItemBase.Location and MapOverlayItemBase.Size properties.

Moreover, the MapOverlayItemBase.Padding and MapOverlay.Margin properties allows you can specify required values of margin and padding.

Note

If the item size is specified manually, then the total size is calculated as size plus padding. In the same way, if location is specified manually, the actual location of an item is dependent on the location and margin.

Also, the location of an item is dependent on the alignment. For example, if MapOverlayItemBase.Alignment is set to BottomRight , then the MapOverlayItemBase.Location property will specify the distance from the bottom right angle of the overlay to the bottom right angle of the item.

Overlay Item Appearance

To customize item appearance, use the MapOverlayItemBase.BackgroundStyle property. In addition it is possible to specify the background style when an item is hit tested. To do this, modify the MapOverlayItemBase.HotTrackedStyle property.

The following image demonstrates hot tracked style applied to the text item.

To hide or show the item, specify the reqired value to the MapOverlayItemBase.Visible property.

See Also

How to: Show Additional Information Over the Map