protected override void AdornedElement_MouseMove(object sender, MouseEventArgs e) { Point CurrentPoint = e.GetPosition(this); if (_CurrentLine != null) { if (e.LeftButton == MouseButtonState.Pressed) { _CurrentLine.EndPoint = CurrentPoint; } else if (e.LeftButton == MouseButtonState.Released) { if (_CurrentLine.Length > 1) { _CurrentLine.SetCorrectPoints(_Zoom, _OffsetX, _OffsetY); _MeasurementLines.Add(_CurrentLine); } _CurrentLine = null; } InvalidateVisual(); } base.AdornedElement_MouseMove(sender, e); }
protected override void RemoveItem_Click(object sender, EventArgs e) { base.RemoveItem_Click(sender, e); _MeasurementLines.Remove(_FocusedLine); _FocusedLine = null; InvalidateVisual(); }
protected override void AdornedElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { base.AdornedElement_MouseLeftButtonDown(sender, e); Point CurrentPoint = e.GetPosition(this); _CurrentLine = new MeasurementLine(CurrentPoint, CurrentPoint); _FocusedLine = null; InvalidateVisual(); }
protected override void OnMouseEnter(MouseEventArgs e) { if (Enabled) { Point CurrentPoint = e.GetPosition(this); foreach (MeasurementLine line in _MeasurementLines) { if (line.Contains(CurrentPoint, _Zoom, _OffsetX, _OffsetY)) { _FocusedLine = line; line.Brush = Brushes.DarkGoldenrod; InvalidateVisual(); break; } } base.OnMouseEnter(e); } }
protected override void AdornedElement_MouseMove (object sender, MouseEventArgs e) { Point CurrentPoint = e.GetPosition(this); if (_CurrentLine != null) { if (e.LeftButton == MouseButtonState.Pressed) { _CurrentLine.EndPoint = CurrentPoint; } else if (e.LeftButton == MouseButtonState.Released) { if (_CurrentLine.Length > 1) { _CurrentLine.SetCorrectPoints(_Zoom, _OffsetX, _OffsetY); _MeasurementLines.Add(_CurrentLine); } _CurrentLine = null; } InvalidateVisual(); } base.AdornedElement_MouseMove(sender, e); }
protected override void OnMouseEnter (MouseEventArgs e) { if (Enabled) { Point CurrentPoint = e.GetPosition(this); foreach (MeasurementLine line in _MeasurementLines) { if (line.Contains(CurrentPoint, _Zoom, _OffsetX, _OffsetY)) { _FocusedLine = line; line.Brush = Brushes.DarkGoldenrod; InvalidateVisual(); break; } } base.OnMouseEnter(e); } }
protected override void RemoveItem_Click (object sender, EventArgs e) { base.RemoveItem_Click(sender, e); _MeasurementLines.Remove(_FocusedLine); _FocusedLine = null; InvalidateVisual(); }
protected override void AdornedElement_MouseLeftButtonDown (object sender, MouseButtonEventArgs e) { base.AdornedElement_MouseLeftButtonDown(sender, e); Point CurrentPoint = e.GetPosition(this); _CurrentLine = new MeasurementLine(CurrentPoint, CurrentPoint); _FocusedLine = null; InvalidateVisual(); }