Exemplo n.º 1
0
        private void setMousePos()
        {
            Point mPoint = PointToClient(Cursor.Position);;

            if (this.ClientRectangle.Contains(mPoint))
            {
                if (mPoint.Y <= rectBtnUp.Bottom)
                {
                    mousePosSection = MouseSection.UpArrow;
                }
                else if (mPoint.Y >= rectBtnDown.Y)
                {
                    mousePosSection = MouseSection.DownArrow;
                }
                else if (mPoint.Y >= rectBtnScroll.Y && mPoint.Y <= rectBtnScroll.Bottom)
                {
                    mousePosSection = MouseSection.BtnBar;
                }
                else
                {
                    mousePosSection = MouseSection.ScrollBar;
                }
            }
            else
            {
                mousePosSection = MouseSection.Out;
            }
        }
Exemplo n.º 2
0
 protected override void OnMouseLeave(EventArgs e)
 {
     base.OnMouseLeave(e);
     mousePosSection = MouseSection.Out;
     setMousePos();
     updateState();
     this.Invalidate();
 }
Exemplo n.º 3
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            Console.WriteLine("OnMouseUp");
            base.OnMouseUp(e);
            isMouseDown = false;
            isMouseDrag = false;
            MouseSection preSection = mousePosSection;

            setMousePos();
            updateState();
            if (preSection != mousePosSection)
            {
            }
            this.Invalidate();
        }
Exemplo n.º 4
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            MouseSection preSection = mousePosSection;

            if (isMouseDown)
            {
                Point mPoint = PointToClient(Cursor.Position);
                if (isMouseDrag || rectBtnScroll.Contains(mPoint))
                {
                    isMouseDrag = true;
                    moveBtnScroll();
                }
            }
            else
            {
                setMousePos();
                updateState();
                if (preSection != mousePosSection)
                {
                    this.Refresh();
                }
            }
        }