Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Measurements.BeforeMeasurement Event

Occurs when a user starts ruler creation.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v24.2.dll

NuGet Package: DevExpress.Win.Map

#Declaration

[Browsable(false)]
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.
RulerType Returns the type of the new ruler.
StartPoint Returns coordinates of the ruler’s start point.
Style Returns style settings of the new ruler.

#Remarks

The Measurements object raises the BeforeMeasurement event after a user sets the ruler’s first point. Use the e.Cancel property to cancel ruler creation. 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:

private void Measurements_BeforeMeasurement(object sender, BeforeMeasurementEventArgs e) {
 MapHitInfo info = this.mapControl1.CalcHitInfo(e.StartPonit);
 if (info.InMapEllipse) {
     e.Cancel = true;
 }    
}
See Also