示例#1
0
        private void OnMouseDown(object sender, MouseEventArgs e)
        {
            if (Enabled)
            {
                Rectangle lMarkRect = new Rectangle(
                    Math.Min(_lMarkPnt[0].X, _lMarkPnt[1].X),                                                        // X
                    Math.Min(_lMarkPnt[0].Y, _lMarkPnt[3].Y),                                                        // Y
                    Math.Abs(_lMarkPnt[2].X - _lMarkPnt[0].X),                                                       // width
                    Math.Max(Math.Abs(_lMarkPnt[0].Y - _lMarkPnt[3].Y), Math.Abs(_lMarkPnt[0].Y - _lMarkPnt[1].Y))); // height
                Rectangle rMarkRect = new Rectangle(
                    Math.Min(_rMarkPnt[0].X, _rMarkPnt[2].X),                                                        // X
                    Math.Min(_rMarkPnt[0].Y, _rMarkPnt[1].Y),                                                        // Y
                    Math.Abs(_rMarkPnt[0].X - _rMarkPnt[2].X),                                                       // width
                    Math.Max(Math.Abs(_rMarkPnt[2].Y - _rMarkPnt[0].Y), Math.Abs(_rMarkPnt[1].Y - _rMarkPnt[0].Y))); // height

                if (lMarkRect.Contains(e.X, e.Y))
                {
                    Capture     = true;
                    _moveLMark  = true;
                    _activeMark = ActiveMarkType.Left;
                    Invalidate(true);
                }

                if (rMarkRect.Contains(e.X, e.Y))
                {
                    Capture     = true;
                    _moveRMark  = true;
                    _activeMark = ActiveMarkType.Right;
                    Invalidate(true);
                }
            }
        }
示例#2
0
        // mouse down event
        private void OnMouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (this.Enabled)
            {
                Rectangle LMarkRect = new Rectangle(
                    Math.Min(LMarkPnt[0].X, LMarkPnt[1].X),                                                      // X
                    Math.Min(LMarkPnt[0].Y, LMarkPnt[3].Y),                                                      // Y
                    Math.Abs(LMarkPnt[2].X - LMarkPnt[0].X),                                                     // width
                    Math.Max(Math.Abs(LMarkPnt[0].Y - LMarkPnt[3].Y), Math.Abs(LMarkPnt[0].Y - LMarkPnt[1].Y))); // height
                Rectangle RMarkRect = new Rectangle(
                    Math.Min(RMarkPnt[0].X, RMarkPnt[2].X),                                                      // X
                    Math.Min(RMarkPnt[0].Y, RMarkPnt[1].Y),                                                      // Y
                    Math.Abs(RMarkPnt[0].X - RMarkPnt[2].X),                                                     // width
                    Math.Max(Math.Abs(RMarkPnt[2].Y - RMarkPnt[0].Y), Math.Abs(RMarkPnt[1].Y - RMarkPnt[0].Y))); // height

                if (LMarkRect.Contains(e.X, e.Y))
                {
                    this.Capture = true;
                    MoveLMark    = true;
                    ActiveMark   = ActiveMarkType.left;
                    Invalidate(true);
                }

                if (RMarkRect.Contains(e.X, e.Y))
                {
                    this.Capture = true;
                    MoveRMark    = true;
                    ActiveMark   = ActiveMarkType.right;
                    Invalidate(true);
                }
            }
        }
示例#3
0
 private void OnMouseDown(object sender, MouseEventArgs e)
 {
     if (Enabled)
     {
         if (_lKnobRect.Contains(e.X, e.Y))
         {
             Capture         = true;
             _lKnobMoveGoing = true;
             _activeKnob     = ActiveMarkType.Left;
             Invalidate(true);
         }
         else if (_rKnobRect.Contains(e.X, e.Y))
         {
             Capture        = true;
             _rKnobIsMoving = true;
             _activeKnob    = ActiveMarkType.Right;
             Invalidate(true);
         }
     }
 }
示例#4
0
 private void OnLeave(object sender, System.EventArgs e)
 {
     ActiveMark = ActiveMarkType.none;
 }
示例#5
0
        // mouse move event
        private void OnMouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if( this.Enabled )
            {
                int h = this.Height;
                int w = this.Width;
                double r1 = (double)rangeMin * (double)w / (double)(Maximum-Minimum);
                double r2 = (double)rangeMax * (double)w / (double)(Maximum-Minimum);
                Rectangle LMarkRect = new Rectangle(
                    Math.Min(LMarkPnt[0].X,LMarkPnt[1].X),		// X
                    Math.Min(LMarkPnt[0].Y,LMarkPnt[3].Y),		// Y
                    Math.Abs(LMarkPnt[2].X-LMarkPnt[0].X),		// width
                    Math.Max(Math.Abs(LMarkPnt[0].Y-LMarkPnt[3].Y),Math.Abs(LMarkPnt[0].Y-LMarkPnt[1].Y)) );	// height
                Rectangle RMarkRect = new Rectangle(
                    Math.Min(RMarkPnt[0].X,RMarkPnt[2].X),		// X
                    Math.Min(RMarkPnt[0].Y,RMarkPnt[1].Y),		// Y
                    Math.Abs(RMarkPnt[0].X-RMarkPnt[2].X),		// width
                    Math.Max(Math.Abs(RMarkPnt[2].Y-RMarkPnt[0].Y),Math.Abs(RMarkPnt[1].Y-RMarkPnt[0].Y)));		// height

                if( LMarkRect.Contains(e.X,e.Y) || RMarkRect.Contains(e.X,e.Y) )
                {
                    if( this.orientationBar==RangeBarOrientation.horizontal )
                        this.Cursor = Cursors.SizeWE;
                    else
                        this.Cursor = Cursors.SizeNS;
                }
                else this.Cursor = Cursors.Arrow;

                if( MoveLMark )
                {
                    if( this.orientationBar==RangeBarOrientation.horizontal )
                        this.Cursor = Cursors.SizeWE;
                    else
                        this.Cursor = Cursors.SizeNS;
                    if( this.orientationBar==RangeBarOrientation.horizontal )
                        PosL = e.X;
                    else
                        PosL = e.Y;
                    if( PosL<XPosMin )
                        PosL = XPosMin;
                    if( PosL>XPosMax )
                        PosL = XPosMax;
                    if( PosR<PosL )
                        PosR = PosL;
                    Pos2Range();
                    ActiveMark = ActiveMarkType.left;
                    Invalidate(true);

                    OnRangeChanging(EventArgs.Empty);
                }
                else if( MoveRMark )
                {
                    if( this.orientationBar==RangeBarOrientation.horizontal )
                        this.Cursor = Cursors.SizeWE;
                    else
                        this.Cursor = Cursors.SizeNS;
                    if( this.orientationBar==RangeBarOrientation.horizontal )
                        PosR = e.X;
                    else
                        PosR = e.Y;
                    if( PosR>XPosMax )
                        PosR = XPosMax;
                    if( PosR<XPosMin )
                        PosR = XPosMin;
                    if( PosL>PosR )
                        PosL = PosR;
                    Pos2Range();
                    ActiveMark = ActiveMarkType.right;
                    Invalidate(true);

                    OnRangeChanging(EventArgs.Empty);
                }
            }
        }
示例#6
0
        // mouse down event
        private void OnMouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if( this.Enabled )
            {
                Rectangle LMarkRect = new Rectangle(
                    Math.Min(LMarkPnt[0].X,LMarkPnt[1].X),		// X
                    Math.Min(LMarkPnt[0].Y,LMarkPnt[3].Y),		// Y
                    Math.Abs(LMarkPnt[2].X-LMarkPnt[0].X),		// width
                    Math.Max(Math.Abs(LMarkPnt[0].Y-LMarkPnt[3].Y),Math.Abs(LMarkPnt[0].Y-LMarkPnt[1].Y)) );	// height
                Rectangle RMarkRect = new Rectangle(
                    Math.Min(RMarkPnt[0].X,RMarkPnt[2].X),		// X
                    Math.Min(RMarkPnt[0].Y,RMarkPnt[1].Y),		// Y
                    Math.Abs(RMarkPnt[0].X-RMarkPnt[2].X),		// width
                    Math.Max(Math.Abs(RMarkPnt[2].Y-RMarkPnt[0].Y),Math.Abs(RMarkPnt[1].Y-RMarkPnt[0].Y)));		// height

                if( LMarkRect.Contains(e.X,e.Y) )
                {
                    this.Capture = true;
                    MoveLMark = true;
                    ActiveMark = ActiveMarkType.left;
                    Invalidate(true);
                }

                if( RMarkRect.Contains(e.X,e.Y) )
                {
                    this.Capture = true;
                    MoveRMark = true;
                    ActiveMark = ActiveMarkType.right;
                    Invalidate(true);
                }
            }
        }
示例#7
0
 private void OnLeave(object sender, EventArgs e)
 {
     _activeMark = ActiveMarkType.None;
 }
示例#8
0
        private void OnMouseMove(object sender, MouseEventArgs e)
        {
            if (Enabled)
            {
                Rectangle lMarkRect = new Rectangle(
                    Math.Min(_lMarkPnt[0].X, _lMarkPnt[1].X),                                                        // X
                    Math.Min(_lMarkPnt[0].Y, _lMarkPnt[3].Y),                                                        // Y
                    Math.Abs(_lMarkPnt[2].X - _lMarkPnt[0].X),                                                       // width
                    Math.Max(Math.Abs(_lMarkPnt[0].Y - _lMarkPnt[3].Y), Math.Abs(_lMarkPnt[0].Y - _lMarkPnt[1].Y))); // height
                Rectangle rMarkRect = new Rectangle(
                    Math.Min(_rMarkPnt[0].X, _rMarkPnt[2].X),                                                        // X
                    Math.Min(_rMarkPnt[0].Y, _rMarkPnt[1].Y),                                                        // Y
                    Math.Abs(_rMarkPnt[0].X - _rMarkPnt[2].X),                                                       // width
                    Math.Max(Math.Abs(_rMarkPnt[2].Y - _rMarkPnt[0].Y), Math.Abs(_rMarkPnt[1].Y - _rMarkPnt[0].Y))); // height

                if (lMarkRect.Contains(e.X, e.Y) || rMarkRect.Contains(e.X, e.Y))
                {
                    if (_orientationBar == RangeBarOrientation.Horizontal)
                    {
                        Cursor = Cursors.SizeWE;
                    }
                    else
                    {
                        Cursor = Cursors.SizeNS;
                    }
                }
                else
                {
                    Cursor = Cursors.Arrow;
                }

                if (_moveLMark)
                {
                    if (_orientationBar == RangeBarOrientation.Horizontal)
                    {
                        Cursor = Cursors.SizeWE;
                    }
                    else
                    {
                        Cursor = Cursors.SizeNS;
                    }
                    if (_orientationBar == RangeBarOrientation.Horizontal)
                    {
                        _pixelPosL = e.X;
                    }
                    else
                    {
                        _pixelPosL = e.Y;
                    }
                    if (_pixelPosL < _xPosMin)
                    {
                        _pixelPosL = _xPosMin;
                    }
                    if (_pixelPosL > _xPosMax)
                    {
                        _pixelPosL = _xPosMax;
                    }
                    if (_pixelPosR < _pixelPosL)
                    {
                        _pixelPosR = _pixelPosL;
                    }
                    PixelPos2RangePos();
                    _activeMark = ActiveMarkType.Left;
                    Invalidate(true);

                    OnRangeChanging(EventArgs.Empty);
                }
                else if (_moveRMark)
                {
                    if (_orientationBar == RangeBarOrientation.Horizontal)
                    {
                        Cursor = Cursors.SizeWE;
                    }
                    else
                    {
                        Cursor = Cursors.SizeNS;
                    }
                    if (_orientationBar == RangeBarOrientation.Horizontal)
                    {
                        _pixelPosR = e.X;
                    }
                    else
                    {
                        _pixelPosR = e.Y;
                    }
                    if (_pixelPosR > _xPosMax)
                    {
                        _pixelPosR = _xPosMax;
                    }
                    if (_pixelPosR < _xPosMin)
                    {
                        _pixelPosR = _xPosMin;
                    }
                    if (_pixelPosL > _pixelPosR)
                    {
                        _pixelPosL = _pixelPosR;
                    }
                    PixelPos2RangePos();
                    _activeMark = ActiveMarkType.Right;
                    Invalidate(true);

                    OnRangeChanging(EventArgs.Empty);
                }
            }
        }
示例#9
0
        // mouse move event
        private void OnMouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (this.Enabled)
            {
                int       h         = this.Height;
                int       w         = this.Width;
                double    r1        = (double)rangeMin * (double)w / (double)(Maximum - Minimum);
                double    r2        = (double)rangeMax * (double)w / (double)(Maximum - Minimum);
                Rectangle LMarkRect = new Rectangle(
                    Math.Min(LMarkPnt[0].X, LMarkPnt[1].X),                                                      // X
                    Math.Min(LMarkPnt[0].Y, LMarkPnt[3].Y),                                                      // Y
                    Math.Abs(LMarkPnt[2].X - LMarkPnt[0].X),                                                     // width
                    Math.Max(Math.Abs(LMarkPnt[0].Y - LMarkPnt[3].Y), Math.Abs(LMarkPnt[0].Y - LMarkPnt[1].Y))); // height
                Rectangle RMarkRect = new Rectangle(
                    Math.Min(RMarkPnt[0].X, RMarkPnt[2].X),                                                      // X
                    Math.Min(RMarkPnt[0].Y, RMarkPnt[1].Y),                                                      // Y
                    Math.Abs(RMarkPnt[0].X - RMarkPnt[2].X),                                                     // width
                    Math.Max(Math.Abs(RMarkPnt[2].Y - RMarkPnt[0].Y), Math.Abs(RMarkPnt[1].Y - RMarkPnt[0].Y))); // height

                if (LMarkRect.Contains(e.X, e.Y) || RMarkRect.Contains(e.X, e.Y))
                {
                    if (this.orientationBar == RangeBarOrientation.horizontal)
                    {
                        this.Cursor = Cursors.SizeWE;
                    }
                    else
                    {
                        this.Cursor = Cursors.SizeNS;
                    }
                }
                else
                {
                    this.Cursor = Cursors.Arrow;
                }

                if (MoveLMark)
                {
                    if (this.orientationBar == RangeBarOrientation.horizontal)
                    {
                        this.Cursor = Cursors.SizeWE;
                    }
                    else
                    {
                        this.Cursor = Cursors.SizeNS;
                    }
                    if (this.orientationBar == RangeBarOrientation.horizontal)
                    {
                        PosL = e.X;
                    }
                    else
                    {
                        PosL = e.Y;
                    }
                    if (PosL < XPosMin)
                    {
                        PosL = XPosMin;
                    }
                    if (PosL > XPosMax)
                    {
                        PosL = XPosMax;
                    }
                    if (PosR < PosL)
                    {
                        PosR = PosL;
                    }
                    Pos2Range();
                    ActiveMark = ActiveMarkType.left;
                    Invalidate(true);

                    OnRangeChanging(EventArgs.Empty);
                }
                else if (MoveRMark)
                {
                    if (this.orientationBar == RangeBarOrientation.horizontal)
                    {
                        this.Cursor = Cursors.SizeWE;
                    }
                    else
                    {
                        this.Cursor = Cursors.SizeNS;
                    }
                    if (this.orientationBar == RangeBarOrientation.horizontal)
                    {
                        PosR = e.X;
                    }
                    else
                    {
                        PosR = e.Y;
                    }
                    if (PosR > XPosMax)
                    {
                        PosR = XPosMax;
                    }
                    if (PosR < XPosMin)
                    {
                        PosR = XPosMin;
                    }
                    if (PosL > PosR)
                    {
                        PosL = PosR;
                    }
                    Pos2Range();
                    ActiveMark = ActiveMarkType.right;
                    Invalidate(true);

                    OnRangeChanging(EventArgs.Empty);
                }
            }
        }
示例#10
0
        // mouse move event
        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (this.Enabled) {
                int h = this.Height;
                int w = this.Width;
                double r1 = (double)m_RangeMin.Ticks * (double)w / (double)(m_Maximum.Ticks - m_Minimum.Ticks);
                double r2 = (double)m_RangeMax.Ticks * (double)w / (double)(m_Maximum.Ticks - m_Minimum.Ticks);
                Rectangle LMarkRect = new Rectangle(
                    Math.Min(m_LMarkPnt[0].X, m_LMarkPnt[1].X),		// X
                    Math.Min(m_LMarkPnt[0].Y, m_LMarkPnt[3].Y),		// Y
                    Math.Abs(m_LMarkPnt[2].X - m_LMarkPnt[0].X),		// width
                    Math.Max(Math.Abs(m_LMarkPnt[0].Y - m_LMarkPnt[3].Y), Math.Abs(m_LMarkPnt[0].Y - m_LMarkPnt[1].Y)));	// height
                Rectangle RMarkRect = new Rectangle(
                    Math.Min(m_RMarkPnt[0].X, m_RMarkPnt[2].X),		// X
                    Math.Min(m_RMarkPnt[0].Y, m_RMarkPnt[1].Y),		// Y
                    Math.Abs(m_RMarkPnt[0].X - m_RMarkPnt[2].X),		// width
                    Math.Max(Math.Abs(m_RMarkPnt[2].Y - m_RMarkPnt[0].Y), Math.Abs(m_RMarkPnt[1].Y - m_RMarkPnt[0].Y)));		// height

                if (LMarkRect.Contains(e.X, e.Y) || RMarkRect.Contains(e.X, e.Y)) {
                    if (this.m_OrientationBar == RangeBarOrientation.Horizontal)
                        this.Cursor = Cursors.SizeWE;
                    else
                        this.Cursor = Cursors.SizeNS;
                } else this.Cursor = Cursors.Arrow;

                if (m_MoveLMark) {
                    if (this.m_OrientationBar == RangeBarOrientation.Horizontal)
                        this.Cursor = Cursors.SizeWE;
                    else
                        this.Cursor = Cursors.SizeNS;
                    if (this.m_OrientationBar == RangeBarOrientation.Horizontal)
                        m_LeftPos = e.X;
                    else
                        m_LeftPos = e.Y;
                    if (m_LeftPos < m_XPosMin)
                        m_LeftPos = m_XPosMin;
                    if (m_LeftPos > m_XPosMax)
                        m_LeftPos = m_XPosMax;
                    if (m_RightPos < m_LeftPos)
                        m_RightPos = m_LeftPos;
                    Pos2Range();
                    m_ActiveMark = ActiveMarkType.Left;
                    Invalidate(true);

                    OnRangeChanging(EventArgs.Empty);
                } else if (m_MoveRMark) {
                    if (this.m_OrientationBar == RangeBarOrientation.Horizontal)
                        this.Cursor = Cursors.SizeWE;
                    else
                        this.Cursor = Cursors.SizeNS;
                    if (this.m_OrientationBar == RangeBarOrientation.Horizontal)
                        m_RightPos = e.X;
                    else
                        m_RightPos = e.Y;
                    if (m_RightPos > m_XPosMax)
                        m_RightPos = m_XPosMax;
                    if (m_RightPos < m_XPosMin)
                        m_RightPos = m_XPosMin;
                    if (m_LeftPos > m_RightPos)
                        m_LeftPos = m_RightPos;
                    Pos2Range();
                    m_ActiveMark = ActiveMarkType.Right;
                    Invalidate(true);

                    OnRangeChanging(EventArgs.Empty);
                }
            }
        }
示例#11
0
        // mouse down event
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (this.Enabled) {
                Rectangle LMarkRect = new Rectangle(
                    Math.Min(m_LMarkPnt[0].X, m_LMarkPnt[1].X),		// X
                    Math.Min(m_LMarkPnt[0].Y, m_LMarkPnt[3].Y),		// Y
                    Math.Abs(m_LMarkPnt[2].X - m_LMarkPnt[0].X),		// width
                    Math.Max(Math.Abs(m_LMarkPnt[0].Y - m_LMarkPnt[3].Y), Math.Abs(m_LMarkPnt[0].Y - m_LMarkPnt[1].Y)));	// height
                Rectangle RMarkRect = new Rectangle(
                    Math.Min(m_RMarkPnt[0].X, m_RMarkPnt[2].X),		// X
                    Math.Min(m_RMarkPnt[0].Y, m_RMarkPnt[1].Y),		// Y
                    Math.Abs(m_RMarkPnt[0].X - m_RMarkPnt[2].X),		// width
                    Math.Max(Math.Abs(m_RMarkPnt[2].Y - m_RMarkPnt[0].Y), Math.Abs(m_RMarkPnt[1].Y - m_RMarkPnt[0].Y)));		// height

                if (LMarkRect.Contains(e.X, e.Y)) {
                    this.Capture = true;
                    m_MoveLMark = true;
                    m_ActiveMark = ActiveMarkType.Left;
                    Invalidate(true);
                }

                if (RMarkRect.Contains(e.X, e.Y)) {
                    this.Capture = true;
                    m_MoveRMark = true;
                    m_ActiveMark = ActiveMarkType.Right;
                    Invalidate(true);
                }
            }
        }
示例#12
0
 protected override void OnLeave(EventArgs e)
 {
     m_ActiveMark = ActiveMarkType.None;
 }
示例#13
0
        private void OnMouseMove(object sender, MouseEventArgs e)
        {
            if (Enabled)
            {
                if (_lKnobRect.Contains(e.X, e.Y) || _rKnobRect.Contains(e.X, e.Y))
                {
                    Cursor = (_orientationBar == RangeBarOrientation.Horizontal) ? Cursors.SizeWE : Cursors.SizeNS;
                }
                else
                {
                    Cursor = Cursors.Arrow;
                }

                if (_lKnobMoveGoing)
                {
                    Cursor = (_orientationBar == RangeBarOrientation.Horizontal) ? Cursors.SizeWE : Cursors.SizeNS;

                    _pixelPosL = (_orientationBar == RangeBarOrientation.Horizontal) ? e.X : e.Y;

                    if (_pixelPosL < PixelPosXmin)
                    {
                        _pixelPosL = PixelPosXmin;
                    }
                    if (_pixelPosL > PixelPosXmax)
                    {
                        _pixelPosL = PixelPosXmax;
                    }
                    if (_pixelPosR < _pixelPosL)
                    {
                        _pixelPosR = _pixelPosL;
                    }

                    PixelPos2RangePos();
                    _activeKnob = ActiveMarkType.Left;
                    Invalidate(true);

                    OnRangeChanging(EventArgs.Empty);
                }
                else if (_rKnobIsMoving)
                {
                    Cursor = (_orientationBar == RangeBarOrientation.Horizontal) ? Cursors.SizeWE : Cursors.SizeNS;

                    _pixelPosR = (_orientationBar == RangeBarOrientation.Horizontal) ? e.X : e.Y;

                    if (_pixelPosR < PixelPosXmin)
                    {
                        _pixelPosR = PixelPosXmin;
                    }
                    if (_pixelPosR > PixelPosXmax)
                    {
                        _pixelPosR = PixelPosXmax;
                    }
                    if (_pixelPosL > _pixelPosR)
                    {
                        _pixelPosL = _pixelPosR;
                    }

                    PixelPos2RangePos();
                    _activeKnob = ActiveMarkType.Right;
                    Invalidate(true);

                    OnRangeChanging(EventArgs.Empty);
                }
            }
        }
示例#14
0
 private void OnLeave(object sender, System.EventArgs e)
 {
     ActiveMark = ActiveMarkType.none;
 }
示例#15
0
        private void OnMouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            Rectangle LMarkRect = new Rectangle(LMarkPnt[0].X,LMarkPnt[0].Y,LMarkPnt[2].X-LMarkPnt[0].X,LMarkPnt[2].Y-LMarkPnt[0].Y);
            Rectangle RMarkRect = new Rectangle(RMarkPnt[2].X,RMarkPnt[0].Y,RMarkPnt[0].X-RMarkPnt[2].X,RMarkPnt[2].Y-RMarkPnt[0].Y);

            if( LMarkRect.Contains(e.X,e.Y) )
            {
                this.Capture = true;
                MoveLMark = true;
                ActiveMark = ActiveMarkType.left;
                Invalidate(true);
            }

            if( RMarkRect.Contains(e.X,e.Y) )
            {
                this.Capture = true;
                MoveRMark = true;
                ActiveMark = ActiveMarkType.right;
                Invalidate(true);
            }
        }
示例#16
0
        private void OnMouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            int h = this.Height;
            int w = this.Width;
            double r1 = (double)rangeMin * (double)w / (double)(Maximum-Minimum);
            double r2 = (double)rangeMax * (double)w / (double)(Maximum-Minimum);
            Rectangle LMarkRect = new Rectangle(LMarkPnt[0].X,LMarkPnt[0].Y,LMarkPnt[2].X-LMarkPnt[0].X,LMarkPnt[2].Y-LMarkPnt[0].Y);
            Rectangle RMarkRect = new Rectangle(RMarkPnt[2].X,RMarkPnt[0].Y,RMarkPnt[0].X-RMarkPnt[2].X,RMarkPnt[2].Y-RMarkPnt[0].Y);

            if( LMarkRect.Contains(e.X,e.Y) || RMarkRect.Contains(e.X,e.Y) )
            {
                this.Cursor = Cursors.SizeWE;
            }
            else this.Cursor = Cursors.Arrow;

            if( MoveLMark )
            {
                this.Cursor = Cursors.SizeWE;
                PosL = e.X;
                if( PosL<XPosMin )
                    PosL = XPosMin;
                if( PosL>XPosMax )
                    PosL = XPosMax;
                if( PosR<PosL )
                    PosR = PosL;
                Pos2Range();
                ActiveMark = ActiveMarkType.left;
                Invalidate(true);
            }
            else if( MoveRMark )
            {
                this.Cursor = Cursors.SizeWE;
                PosR = e.X;
                if( PosR>XPosMax )
                    PosR = XPosMax;
                if( PosR<XPosMin )
                    PosR = XPosMin;
                if( PosL>PosR )
                    PosL = PosR;
                Pos2Range();
                ActiveMark = ActiveMarkType.right;
                Invalidate(true);
            }
        }
示例#17
0
        // mouse move event
        private void OnMouseMove(object sender, MouseEventArgs e)
        {
            if (Enabled)
            {
                Rectangle LMarkRect = new Rectangle(
                    Math.Min(_pointsLeft[0].X, _pointsLeft[1].X),  // X
                    Math.Min(_pointsLeft[0].Y, _pointsLeft[3].Y),  // Y
                    Math.Abs(_pointsLeft[2].X - _pointsLeft[0].X), // width
                    Math.Max(Math.Abs(_pointsLeft[0].Y - _pointsLeft[3].Y), Math.Abs(_pointsLeft[0].Y - _pointsLeft[1].Y)));
                // height
                Rectangle RMarkRect = new Rectangle(
                    Math.Min(_pointsRight[0].X, _pointsRight[2].X),  // X
                    Math.Min(_pointsRight[0].Y, _pointsRight[1].Y),  // Y
                    Math.Abs(_pointsRight[0].X - _pointsRight[2].X), // width
                    Math.Max(Math.Abs(_pointsRight[2].Y - _pointsRight[0].Y), Math.Abs(_pointsRight[1].Y - _pointsRight[0].Y)));
                // height

                if (LMarkRect.Contains(e.X, e.Y) || RMarkRect.Contains(e.X, e.Y))
                {
                    if (_barOrientation == RangeBarOrientation.Horizontal)
                    {
                        Cursor = Cursors.SizeWE;
                    }
                    else
                    {
                        Cursor = Cursors.SizeNS;
                    }
                }
                else
                {
                    Cursor = Cursors.Arrow;
                }

                if (_moveLMark)
                {
                    if (_barOrientation == RangeBarOrientation.Horizontal)
                    {
                        Cursor = Cursors.SizeWE;
                    }
                    else
                    {
                        Cursor = Cursors.SizeNS;
                    }
                    if (_barOrientation == RangeBarOrientation.Horizontal)
                    {
                        _posLeft = e.X;
                    }
                    else
                    {
                        _posLeft = e.Y;
                    }
                    if (_posLeft < _xPosMin)
                    {
                        _posLeft = _xPosMin;
                    }
                    if (_posLeft > _xPosMax)
                    {
                        _posLeft = _xPosMax;
                    }
                    if (_posRight < _posLeft)
                    {
                        _posRight = _posLeft;
                    }
                    if (pos2Range())
                    {
                        _activeMark = ActiveMarkType.Left;
                        Invalidate(true);
                        OnRangeChanging(EventArgs.Empty);
                    }
                }
                else if (_moveRMark)
                {
                    if (_barOrientation == RangeBarOrientation.Horizontal)
                    {
                        Cursor = Cursors.SizeWE;
                    }
                    else
                    {
                        Cursor = Cursors.SizeNS;
                    }
                    if (_barOrientation == RangeBarOrientation.Horizontal)
                    {
                        _posRight = e.X;
                    }
                    else
                    {
                        _posRight = e.Y;
                    }
                    if (_posRight > _xPosMax)
                    {
                        _posRight = _xPosMax;
                    }
                    if (_posRight < _xPosMin)
                    {
                        _posRight = _xPosMin;
                    }
                    if (_posLeft > _posRight)
                    {
                        _posLeft = _posRight;
                    }
                    if (pos2Range())
                    {
                        _activeMark = ActiveMarkType.Right;
                        Invalidate(true);
                        OnRangeChanging(EventArgs.Empty);
                    }
                }
            }
        }