Back to Devexpress

Measurements.BeforeMeasurement Event

windowsforms-devexpress-dot-xtramap-dot-measurements-3bc36853.md

latest3.1 KB
Original Source

Measurements.BeforeMeasurement Event

Occurs when a user starts ruler creation.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
[Browsable(false)]
public event BeforeMeasurementEventHandler BeforeMeasurement
vb
<Browsable(False)>
Public Event BeforeMeasurement As BeforeMeasurementEventHandler

Event Data

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

PropertyDescription
CancelGets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
RulerTypeReturns the type of the new ruler.
StartPointReturns coordinates of the ruler’s start point.
StyleReturns 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:

csharp
private void Measurements_BeforeMeasurement(object sender, BeforeMeasurementEventArgs e) {
 MapHitInfo info = this.mapControl1.CalcHitInfo(e.StartPonit);
 if (info.InMapEllipse) {
     e.Cancel = true;
 }    
}
vb
Private Sub Measurements_BeforeMeasurement(ByVal sender As Object, ByVal e As BeforeMeasurementEventArgs)
 Dim info As MapHitInfo = Me.mapControl1.CalcHitInfo(e.StartPonit)
 If info.InMapEllipse Then
     e.Cancel = True
 End If
End Sub

See Also

AfterMeasurement

Measurements Class

Measurements Members

DevExpress.XtraMap Namespace