Exemple #1
0
        private void DrawContent(Graphics g)
        {
            GDIHelper.InitializeGraphics(g);
            int       width  = base.Width;
            int       height = base.Height;
            Rectangle rect   = new Rectangle(_Margin, height / 2 - _MaxRadius, _MaxRadius * 2, _MaxRadius * 2);
            Rectangle rect2  = new Rectangle(_Margin + _MaxRadius - _MinRadius, height / 2 - _MinRadius, _MinRadius * 2, _MinRadius * 2);
            Size      size   = g.MeasureString(Text, Font).ToSize();
            Rectangle bounds = default(Rectangle);

            bounds.X      = rect.Right + _Margin;
            bounds.Y      = height / 2 - size.Height / 2 + 1;
            bounds.Height = size.Height;
            bounds.Width  = base.Width - bounds.Left;
            GDIHelper.DrawEllipseBorder(g, rect, SkinManager.CurrentSkin.BorderColor, 2);
            GDIHelper.FillEllipse(g, rect2, SkinManager.CurrentSkin.DefaultControlColor.First);
            GDIHelper.DrawEllipseBorder(g, rect2, SkinManager.CurrentSkin.BorderColor, 1);
            switch (_ControlState)
            {
            case EnumControlState.HeightLight:
            case EnumControlState.Focused:
                rect.Inflate(1, 1);
                GDIHelper.DrawEllipseBorder(g, rect, SkinManager.CurrentSkin.OuterBorderColor, 1);
                rect.Inflate(-2, -2);
                GDIHelper.DrawEllipseBorder(g, rect, SkinManager.CurrentSkin.InnerBorderColor, 1);
                break;
            }
            Color foreColor = base.Enabled ? ForeColor : SkinManager.CurrentSkin.UselessColor;

            TextRenderer.DrawText(g, Text, Font, bounds, foreColor, TextFormatFlags.Default);
            if (base.Checked)
            {
                GDIHelper.FillEllipse(g, rect2, Color.FromArgb(15, 216, 32), Color.Green);
                foreColor = SkinManager.CurrentSkin.BorderColor;
                GDIHelper.DrawEllipseBorder(g, rect2, foreColor, 1);
            }
        }
Exemple #2
0
        protected void DrawRibbonBtn(Graphics g)
        {
            Rectangle rect = new Rectangle(0, base.CaptionHeight, base.Width, base.Height - base.CaptionHeight + 1);

            g.SetClip(rect, CombineMode.Exclude);
            GDIHelper.InitializeGraphics(g);
            Rectangle ribbonBtnRect = RibbonBtnRect;

            ribbonBtnRect.Inflate(-1, -1);
            GDIHelper.FillEllipse(g, ribbonBtnRect, Color.White);
            Color empty      = Color.Empty;
            Color empty2     = Color.Empty;
            Color lightColor = Color.FromArgb(232, 246, 250);
            Blend blend      = new Blend();

            blend.Positions = new float[5]
            {
                0f,
                0.3f,
                0.5f,
                0.8f,
                1f
            };
            blend.Factors = new float[5]
            {
                0.15f,
                0.55f,
                0.7f,
                0.8f,
                0.95f
            };
            switch (_RibbonBtnState)
            {
            case EnumControlState.HeightLight:
                empty  = Color.FromArgb(225, 179, 27);
                empty2 = Color.FromArgb(255, 251, 232);
                break;

            case EnumControlState.Focused:
                empty  = Color.FromArgb(191, 113, 5);
                empty2 = Color.FromArgb(248, 227, 222);
                break;

            default:
                empty           = Color.FromArgb(239, 246, 249);
                empty2          = Color.FromArgb(224, 221, 231);
                blend.Positions = new float[5]
                {
                    0f,
                    0.3f,
                    0.5f,
                    0.85f,
                    1f
                };
                blend.Factors = new float[5]
                {
                    0.95f,
                    0.7f,
                    0.45f,
                    0.3f,
                    0.15f
                };
                break;
            }
            GDIHelper.DrawCrystalButton(g, ribbonBtnRect, empty, empty2, lightColor, blend);
            Color color = Color.FromArgb(65, 177, 199);

            GDIHelper.DrawEllipseBorder(g, ribbonBtnRect, color, 1);
            GDIHelper.DrawImage(imgSize: new Size(20, 20), g: g, rect: ribbonBtnRect, img: Resources.naruto);
            g.ResetClip();
        }