Beyond_Beyaan.BBScrollBarNoArrows.MouseDown C# (CSharp) Метод

MouseDown() публичный Метод

public MouseDown ( int x, int y ) : bool
x int
y int
Результат bool
        public bool MouseDown(int x, int y)
        {
            if (_isEnabled)
            {
                if (!_isSlider && _scroll.MouseDown(x, y))
                {
                    _scrollSelected = true;
                    if (_isHorizontal)
                    {
                        _initialMousePos = x;
                    }
                    else
                    {
                        _initialMousePos = y;
                    }
                    _initialScrollPos = _scrollPos;
                    return true;
                }
                //at this point, only the scroll bar itself is left
                if ((_isHorizontal && (x >= _xPos && x < _xPos + _scrollBarLength && _yPos <= y && y < _yPos + 5))
                    || (!_isHorizontal && (x >= _xPos && x < _xPos + 5 && _yPos <= y && y < _yPos + _scrollBarLength)))
                {
                    if (!_isSlider)
                    {
                        //clicked on the bar itself, jump up one page
                        if ((!_isHorizontal && y < _yPos + _scrollPos) || (_isHorizontal && x < _xPos + _scrollPos))
                        {
                            _topIndex -= _amountVisible;
                            if (_topIndex < 0)
                            {
                                _topIndex = 0;
                            }
                        }
                        else
                        {
                            //since up is checked already, jump down one page
                            _topIndex += _amountVisible;
                            if (_topIndex > (_amountOfItems - _amountVisible))
                            {
                                _topIndex = (_amountOfItems - _amountVisible);
                            }
                        }
                        SetScrollButtonPosition();
                    }
                    else
                    {
                        _scrollSelected = true;
                    }
                    return true;
                }
            }
            return false;
        }