Пример #1
0
        private void UserControl_MouseWheel(object sender, MouseEventArgs e)
        {
            if (e.Delta > 0)
            {
                _min += 1;
                _max += 1;
            }
            else
            {
                _min -= 1;
                _max -= 1;
            }

            if (_min < 0)
            {
                _min = 0;
            }

            if (_max + cursorWidth > Width)
            {
                _max = Width - cursorWidth;
            }

            if (_min > _max)
            {
                _min = _max - cursorWidth;
            }

            Invalidate();

            if (RangeChangedEvent != null)
            {
                RangeChangedEvent.Invoke(this, _min, _max);
            }
        }
Пример #2
0
        private void UserControl1_MouseMove(object sender, MouseEventArgs e)
        {
            if (TheMouseStateMachine == MouseStateMachine.LeftMove)
            {
                Min         += e.Location.X - clicPosition.X;
                clicPosition = e.Location;

                if (Min < 0)
                {
                    Min = 0;
                }

                if (Min + cursorWidth > Width)
                {
                    Min = Width - cursorWidth;
                }

                if (Min + cursorWidth > Max)
                {
                    Min = Max - cursorWidth;
                }
            }
            else if (TheMouseStateMachine == MouseStateMachine.RightMove)
            {
                Max         += e.Location.X - clicPosition.X;
                clicPosition = e.Location;

                if (Max < 0)
                {
                    Max = 0;
                }

                if (Max + cursorWidth > Width)
                {
                    Max = Width - cursorWidth;
                }

                if (Max < Min + cursorWidth)
                {
                    Max = Min + cursorWidth;
                }
            }

            if (RangeChangedEvent != null)
            {
                RangeChangedEvent.Invoke(this, _min, _max + cursorWidth);
            }
        }
Пример #3
0
 remove => RemoveHandler(RangeChangedEvent, value);
Пример #4
0
 add => AddHandler(RangeChangedEvent, value);