All docs
V20.2
21.1 (EAP/Beta)
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Measurements.BeforeMeasurement Event

Occurs when a user starts ruler creation.

Namespace: DevExpress.Xpf.Map

Assembly: DevExpress.Xpf.Map.v20.2.dll

Declaration

public event BeforeMeasurementEventHandler BeforeMeasurement

Event Data

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

Property Description
Cancel Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
RulerAppearance Specifies ruler appearance settings.
RulerType Returns the type of the new ruler.
StartPoint Returns coordinates of the ruler's start point.

Remarks

The Measurements object raises the BeforeMeasurement event after a user sets the ruler's first point. To cancel ruler creation, use the e.Cancel property. The e.StartPoint property returns the ruler's first point. To determine the type of ruler that a user wishes to add, use the e.RulerType property.

The example below cancels ruler creation if a ruler starts inside an ellipse. The MapControl.CalcHitInfo method returns information on the map elements located at the ruler's first point. The e.StartPoint property returns this point.

private void Measurements_BeforeMeasurement(object sender, BeforeMeasurementEventArgs e) {

 // Convert coordinates to the screen point.
 Point startPoint = mapControl1.CoordPointToScreenPoint(e.StartPoint);

 MapHitInfo info = mapControl1.CalcHitInfo(startPoint);
 if (info.InMapEllipse) {
   e.Cancel = true;
 }
}
See Also