示例#1
0
        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);

            if (MouseState != MouseState.DOWN)
            {
                Cursor = Cursors.Default;
                CursorUpdate?.Invoke(this, Cursor);
            }

            if (AutoShow)
            {
                Hide();
            }
        }
示例#2
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (DesignMode)
            {
                return;
            }

            if (_drawerItemRects == null)
            {
                UpdateTabRects();
            }

            Cursor previousCursor = Cursor;

            if (e.Location.X + this.Location.X < BORDER_WIDTH)
            {
                if (e.Location.Y > this.Height - BORDER_WIDTH)
                {
                    Cursor = Cursors.SizeNESW;                  //Bottom Left
                }
                else
                {
                    Cursor = Cursors.SizeWE;                    //Left
                }
            }
            else if (e.Location.Y > this.Height - BORDER_WIDTH)
            {
                Cursor = Cursors.SizeNS;                        //Bottom
            }
            else
            {
                if (e.Location.Y < _drawerItemRects[_drawerItemRects.Count - 1].Bottom && (e.Location.X + this.Location.X) >= BORDER_WIDTH)
                {
                    Cursor = Cursors.Hand;
                }
                else
                {
                    Cursor = Cursors.Default;
                }
            }

            if (previousCursor != Cursor)
            {
                CursorUpdate?.Invoke(this, Cursor);
            }
        }
示例#3
0
        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);

            if (MouseState != MouseState.DOWN)
            {
                Cursor = Cursors.Default;
                CursorUpdate?.Invoke(this, Cursor);
            }

            if (AutoShow)
            {
                if (DisplayRectangle.Contains(Control.MousePosition) == false)
                {
                    Hide();
                }
            }
        }
示例#4
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (DesignMode)
            {
                return;
            }

            if (e.Button == MouseButtons.Left && e.Y != _lastMouseY && (Location.Y < 0 || Height < (8 + drawerItemHeight) * _drawerItemRects.Count))
            {
                int diff = e.Y - _lastMouseY;
                if (diff > 0)
                {
                    if (Location.Y < 0)
                    {
                        Location = new Point(Location.X, Location.Y + diff > 0 ? 0 : Location.Y + diff);
                        Height   = Parent.Height + Math.Abs(Location.Y);
                    }
                }
                else
                {
                    if (Height < (8 + drawerItemHeight) * _drawerItemRects.Count)
                    {
                        Location = new Point(Location.X, Location.Y + diff);
                        Height   = Parent.Height + Math.Abs(Location.Y);
                    }
                }
                //return;
            }

            base.OnMouseMove(e);

            if (_drawerItemRects == null)
            {
                UpdateTabRects();
            }

            Cursor previousCursor = Cursor;

            if (e.Location.X + this.Location.X < BORDER_WIDTH)
            {
                if (e.Location.Y > this.Height - BORDER_WIDTH)
                {
                    Cursor = Cursors.SizeNESW;                  //Bottom Left
                }
                else
                {
                    Cursor = Cursors.SizeWE;                    //Left
                }
            }
            else if (e.Location.Y > this.Height - BORDER_WIDTH)
            {
                Cursor = Cursors.SizeNS;                        //Bottom
            }
            else
            {
                if (e.Location.Y < _drawerItemRects[_drawerItemRects.Count - 1].Bottom && (e.Location.X + this.Location.X) >= BORDER_WIDTH)
                {
                    Cursor = Cursors.Hand;
                }
                else
                {
                    Cursor = Cursors.Default;
                }
            }

            if (previousCursor != Cursor)
            {
                CursorUpdate?.Invoke(this, Cursor);
            }
        }