Ejemplo n.º 1
0
            private void DrawUpDownButton()
            {
                bool mouseOver       = false;
                bool mousePress      = LeftKeyPressed();
                bool mouseInUpButton = false;

                Rectangle clipRect = _upDownButton.ClientRectangle;

                RECT  windowRect  = new RECT();
                Point cursorPoint = new Point();

                GetCursorPos(ref cursorPoint);
                GetWindowRect(_upDownButtonWnd, ref windowRect);

                mouseOver = PtInRect(ref windowRect, cursorPoint);

                cursorPoint.X -= windowRect.Left;
                cursorPoint.Y -= windowRect.Top;

                mouseInUpButton = cursorPoint.Y < clipRect.Height / 2;

                using (Graphics g = Graphics.FromHwnd(_upDownButtonWnd))
                {
                    UpDownButtonPaintEventArgs e =
                        new UpDownButtonPaintEventArgs(
                            g,
                            clipRect,
                            mouseOver,
                            mousePress,
                            mouseInUpButton);
                    _owner.OnPaintUpDownButton(e);
                }
            }