Example #1
0
        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);
        }
Example #2
0
        protected override void RemoveItem_Click(object sender, EventArgs e)
        {
            base.RemoveItem_Click(sender, e);

            _MeasurementLines.Remove(_FocusedLine);
            _FocusedLine = null;

            InvalidateVisual();
        }
Example #3
0
        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();
        }
Example #4
0
        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);
            }
        }
Example #5
0
        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);
        }
Example #6
0
        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);
            }            
        }
Example #7
0
        protected override void RemoveItem_Click (object sender, EventArgs e)
        {
            base.RemoveItem_Click(sender, e);

            _MeasurementLines.Remove(_FocusedLine);
            _FocusedLine = null;

            InvalidateVisual();
        }
Example #8
0
        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();
        }