示例#1
0
 protected override bool ClosesDropDownAt(Point p)
 {
     return(!(
                ButtonDropDownBounds.Contains(p) ||
                ButtonDownBounds.Contains(p) ||
                ButtonUpBounds.Contains(p) ||
                (ScrollType == ListScrollType.Scrollbar && ScrollBarBounds.Contains(p))
                ));
 }
示例#2
0
        public override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (ButtonDownSelected || ButtonUpSelected || ButtonDropDownSelected)
            {
                IgnoreDeactivation();
            }

            if (ButtonDownSelected && ButtonDownEnabled)
            {
                _buttonDownPressed = true;
                ScrollDown();
            }

            if (ButtonUpSelected && ButtonUpEnabled)
            {
                _buttonUpPressed = true;
                ScrollUp();
            }

            if (ButtonDropDownSelected)
            {
                _buttonDropDownPressed = true;
                ShowDropDown();
            }

            if (ThumbSelected)
            {
                _thumbPressed = true;
                _thumbOffset  = e.Y - _thumbBounds.Y;
            }

            if (
                ScrollType == ListScrollType.Scrollbar &&
                ScrollBarBounds.Contains(e.Location) &&
                e.Y >= ButtonUpBounds.Bottom && e.Y <= ButtonDownBounds.Y &&
                !ThumbBounds.Contains(e.Location) &&
                !ButtonDownBounds.Contains(e.Location) &&
                !ButtonUpBounds.Contains(e.Location))
            {
                //clicked the scroll area above or below the thumb
                if (e.Y < ThumbBounds.Y)
                {
                    ScrollOffset(ContentBounds.Height);
                }
                else
                {
                    ScrollOffset(-ContentBounds.Height);
                }
            }
        }
示例#3
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (Cursor == Cursors.SizeNWSE)
            {
                _resizeOrigin = new Point(e.X, e.Y);
                _resizeSize   = Size;
                _resizing     = true;
            }
            if (ButtonDownSelected || ButtonUpSelected)
            {
                IgnoreDeactivation();
            }

            if (ButtonDownSelected && ButtonDownEnabled)
            {
                _buttonDownPressed = true;
                ScrollDown();
            }

            if (ButtonUpSelected && ButtonUpEnabled)
            {
                _buttonUpPressed = true;
                ScrollUp();
            }

            if (ThumbSelected)
            {
                _thumbPressed = true;
                _thumbOffset  = e.Y - _thumbBounds.Y;
            }

            if (
                ScrollBarBounds.Contains(e.Location) &&
                e.Y >= ButtonUpBounds.Bottom && e.Y <= ButtonDownBounds.Y &&
                !ThumbBounds.Contains(e.Location) &&
                !ButtonDownBounds.Contains(e.Location) &&
                !ButtonUpBounds.Contains(e.Location))
            {
                if (e.Y < ThumbBounds.Y)
                {
                    ScrollOffset(Bounds.Height);
                }
                else
                {
                    ScrollOffset(-Bounds.Height);
                }
            }
        }