コード例 #1
0
    protected override void OnPaint(PaintEventArgs e)
    {
        G = e.Graphics;
        G.SmoothingMode     = SmoothingMode.HighQuality;
        G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
        base.OnPaint(e);
        bool enabled = Enabled;

        if (enabled)
        {
            XylosButton.MouseState state = State;
            if (state != MouseState.Over)
            {
                if (state != MouseState.Down)
                {
                    using (SolidBrush solidBrush = new SolidBrush(Helpers.ColorFromHex("#F6F6F6"))) {
                        G.FillPath(solidBrush, Helpers.RoundRect(Helpers.FullRectangle(Size, true), 3, Helpers.RoundingStyle.All));
                    }
                }
                else
                {
                    using (SolidBrush solidBrush2 = new SolidBrush(Helpers.ColorFromHex("#F0F0F0"))) {
                        G.FillPath(solidBrush2, Helpers.RoundRect(Helpers.FullRectangle(Size, true), 3, Helpers.RoundingStyle.All));
                    }
                }
            }
            else
            {
                using (SolidBrush solidBrush3 = new SolidBrush(Helpers.ColorFromHex("#FDFDFD"))) {
                    G.FillPath(solidBrush3, Helpers.RoundRect(Helpers.FullRectangle(Size, true), 3, Helpers.RoundingStyle.All));
                }
            }
            using (Font font = new Font("Segoe UI", 9f)) {
                using (Pen pen = new Pen(Helpers.ColorFromHex("#C3C3C3"))) {
                    G.DrawPath(pen, Helpers.RoundRect(Helpers.FullRectangle(Size, true), 3, Helpers.RoundingStyle.All));
                    Helpers.CenterString(G, Text, font, Helpers.ColorFromHex("#7C858E"), Helpers.FullRectangle(Size, false));
                }
            }
        }
        else
        {
            using (SolidBrush solidBrush4 = new SolidBrush(Helpers.ColorFromHex("#F3F4F7"))) {
                using (Pen pen2 = new Pen(Helpers.ColorFromHex("#DCDCDC"))) {
                    using (Font font2 = new Font("Segoe UI", 9f)) {
                        G.FillPath(solidBrush4, Helpers.RoundRect(Helpers.FullRectangle(Size, true), 3, Helpers.RoundingStyle.All));
                        G.DrawPath(pen2, Helpers.RoundRect(Helpers.FullRectangle(Size, true), 3, Helpers.RoundingStyle.All));
                        Helpers.CenterString(G, Text, font2, Helpers.ColorFromHex("#D0D3D7"), Helpers.FullRectangle(Size, false));
                    }
                }
            }
        }
    }
コード例 #2
0
    protected override void OnMouseUp(MouseEventArgs e)
    {
        base.OnMouseUp(e);
        bool enabled = Enabled;

        if (enabled)
        {
            XylosButton.ClickEventHandler clickEvent = ClickEvent;
            if (clickEvent != null)
            {
                clickEvent(this, e);
            }
        }
        State = MouseState.Over;
        Invalidate();
    }
コード例 #3
0
 protected override void OnMouseDown(MouseEventArgs e)
 {
     base.OnMouseDown(e);
     State = MouseState.Down;
     Invalidate();
 }
コード例 #4
0
 protected override void OnMouseLeave(EventArgs e)
 {
     base.OnMouseLeave(e);
     State = MouseState.None;
     Invalidate();
 }
コード例 #5
0
 protected override void OnMouseEnter(EventArgs e)
 {
     base.OnMouseEnter(e);
     State = MouseState.Over;
     Invalidate();
 }