Esempio n. 1
0
            private void DrawUpDownButton()
            {
                bool flag       = false;
                bool mousePress = LeftKeyPressed();
                bool flag2      = false;
                RECT r          = default(RECT);

                Win32.GetClientRect(base.Handle, ref r);
                Rectangle clipRect = Rectangle.FromLTRB(r.top, r.left, r.right, r.bottom);
                Point     lpPoint  = default(Point);

                Win32.GetCursorPos(ref lpPoint);
                Win32.GetWindowRect(base.Handle, ref r);
                flag       = Win32.PtInRect(ref r, lpPoint);
                lpPoint.X -= r.left;
                lpPoint.Y -= r.top;
                flag2      = (lpPoint.X < clipRect.Width / 2);
                using (Graphics graphics = Graphics.FromHwnd(base.Handle))
                {
                    UpDownButtonPaintEventArgs e = new UpDownButtonPaintEventArgs(graphics, clipRect, flag, mousePress, flag2);
                    _owner.OnPaintUpDownButton(e);
                }
            }
Esempio n. 2
0
        protected virtual void OnPaintUpDownButton(UpDownButtonPaintEventArgs e)
        {
            Graphics  graphics      = e.Graphics;
            Rectangle clipRectangle = e.ClipRectangle;
            Color     baseColor     = SkinManager.CurrentSkin.DefaultControlColor.First;
            Color     borderColor   = _BorderColor;
            Color     arrowColor    = Color.Green;
            Color     baseColor2    = SkinManager.CurrentSkin.DefaultControlColor.First;
            Color     borderColor2  = _BorderColor;
            Color     arrowColor2   = Color.Green;
            Rectangle rect          = clipRectangle;

            rect.X      += 2;
            rect.Y      += 2;
            rect.Width   = clipRectangle.Width / 2 - 4;
            rect.Height -= 4;
            Rectangle rect2 = clipRectangle;

            rect2.X       = rect.Right;
            rect2.Y      += 2;
            rect2.Width   = clipRectangle.Width / 2 - 4;
            rect2.Height -= 4;
            if (base.Enabled)
            {
                if (e.MouseOver)
                {
                    if (e.MousePress)
                    {
                        if (e.MouseInUpButton)
                        {
                            baseColor = SkinManager.CurrentSkin.HeightLightControlColor.First;
                        }
                        else
                        {
                            baseColor2 = SkinManager.CurrentSkin.HeightLightControlColor.First;
                        }
                    }
                    else if (e.MouseInUpButton)
                    {
                        baseColor = SkinManager.CurrentSkin.DefaultControlColor.First;
                    }
                    else
                    {
                        baseColor2 = SkinManager.CurrentSkin.DefaultControlColor.First;
                    }
                }
            }
            else
            {
                baseColor    = SystemColors.Control;
                borderColor  = SystemColors.ControlDark;
                arrowColor   = SystemColors.ControlDark;
                baseColor2   = SystemColors.Control;
                borderColor2 = SystemColors.ControlDark;
                arrowColor2  = SystemColors.ControlDark;
            }
            GDIHelper.FillPath(graphics, new RoundRectangle(clipRectangle, default(CornerRadius)), _BackColor, _BackColor);
            RenderButton(graphics, rect, baseColor, borderColor, arrowColor, ArrowDirection.Left);
            RenderButton(graphics, rect2, baseColor2, borderColor2, arrowColor2, ArrowDirection.Right);
            (base.Events[EventPaintUpDownButton] as UpDownButtonPaintEventHandler)?.Invoke(this, e);
        }