public virtual void OnRangeChanging(RangeEventArgs e) { if (RangeChanging != null) RangeChanging(this, e); }
protected override void OnMouseMove(MouseEventArgs e) { if (this.Enabled) { base.OnMouseMove(e); RangeEventArgs eEventArgs = new RangeEventArgs(); if (thumbRectL.Contains(e.X, e.Y) || thumbRectR.Contains(e.X, e.Y)) { if (this.Orientation == Orientation.Horizontal) this.Cursor = Cursors.Hand; else this.Cursor = Cursors.Hand; } else if (elapsedRect.Contains(e.X, e.Y)) { if (this.Orientation == Orientation.Horizontal) this.Cursor = Cursors.Hand; else this.Cursor = Cursors.Hand; } else { this.Cursor = Cursors.Arrow; } if (e.Button == MouseButtons.Left) { if (MoveLMark) { if (_orientation == Orientation.Horizontal) PosL = e.X; else PosL = e.Y; if (PosL < XPosMin) PosL = XPosMin; if (PosL > XPosMax) PosL = XPosMax; if (PosR < PosL) PosR = PosL; Pos2Range(); Invalidate(true); } else if (MoveRMark) { if (_orientation == Orientation.Horizontal) PosR = e.X; else PosR = e.Y; if (PosR > XPosMax) PosR = XPosMax; if (PosR < XPosMin) PosR = XPosMin; if (PosL > PosR) PosL = PosR; Pos2Range(); Invalidate(true); } else if (MoveMMark) { if (_dynamicMove) { if (_orientation == Orientation.Horizontal) PosMd = e.X; else PosMd = e.Y; if (PosMd - XPosMin_PosM < XPosMin) { PosMd = XPosMin + XPosMin_PosM; PosL = XPosMin; PosR = XPosMin + XPosMin_PosM; } if (PosMd + PosM_XPosMax > XPosMax) { PosMd = XPosMax - PosM_XPosMax; PosR = XPosMax; PosL = XPosMax - PosM_XPosMax; } Pos2Range(); Invalidate(true); } } eEventArgs.ValueMin = _valueMin; eEventArgs.ValueMax = _valueMax; OnRangeChanging(eEventArgs); } } }
protected override void OnMouseUp(MouseEventArgs e) { if (this.Enabled) { base.OnMouseUp(e); RangeEventArgs eEventArgs = new RangeEventArgs(); this.Capture = false; MoveLMark = false; MoveRMark = false; MoveMMark = false; Invalidate(); eEventArgs.ValueMin = _valueMin; eEventArgs.ValueMax = _valueMax; OnRangeChanged(eEventArgs); } }