Skip to main content
A newer version of this page is available. .

ExportMapItemEventArgs.IsSelected Property

Gets a value that indicates whether an exported map item is selected.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v19.2.dll

Declaration

public bool IsSelected { get; }

Property Value

Type Description
Boolean

true, if a map item is selected; otherwise, false.

Remarks

Use the IsSelected property to determine whether an exported map item is selected when handling the MapControl.ExportMapItem event.

Example

The following example demonstrates how to export selected map items to an image.

To do this, handle the MapControl.ExportMapItem event and set the ExportMapItemEventArgs.Cancel property to true if the map item is not selected (the ExportMapItemEventArgs.IsSelected property is set to false). Then, call the MapControl.ExportToImage method using the map path (where the map image should be stored) and the specified image format (e.g., .png).

using System;
using System.Windows.Forms;
using System.Drawing.Imaging;
using DevExpress.XtraMap;
using System.Diagnostics;

namespace ExportSelectedItems {
    public partial class Form1 : Form {
        string mapPath = "Image.png";

        public Form1() {
            InitializeComponent();
            mapControl1.ExportMapItem += mapControl1_ExportMapItem;
        }

        private void mapControl1_ExportMapItem(object sender, ExportMapItemEventArgs e) {
            if (!e.IsSelected)
                e.Cancel = true;
        }

        private void simpleButton1_Click(object sender, EventArgs e) {
            mapControl1.ExportToImage(mapPath, ImageFormat.Png);
            Process.Start(mapPath);
        }
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the IsSelected property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also