Example #1
0
        protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
        {
            ToolStripItem item     = e.Item;
            Graphics      graphics = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            if (item.Tag != null && item.Tag.Equals("Vicky"))
            {
                int       num  = (item.Width >= item.Height) ? item.Height : item.Width;
                Rectangle rect = new Rectangle(0, 0, num, num);
                rect.Inflate(-1, -1);
                Color empty      = Color.Empty;
                Color empty2     = Color.Empty;
                Color lightColor = Color.FromArgb(255, 220, 102);
                Blend blend      = new Blend();
                blend.Positions = new float[3]
                {
                    0f,
                    0.5f,
                    1f
                };
                blend.Factors = new float[3]
                {
                    0.25f,
                    0.75f,
                    1f
                };
                Color color = (item.Selected || item.Pressed) ? Color.FromArgb(24, 116, 205) : SkinManager.CurrentSkin.BorderColor;
                float width = 1f;
                graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
                if (item.Selected || item.Pressed)
                {
                    width  = 2f;
                    empty  = Color.FromArgb(255, 226, 48);
                    empty2 = Color.FromArgb(255, 220, 102);
                    GDIHelper.DrawCrystalButton(graphics, rect, empty, empty2, lightColor, blend);
                }
                using (Pen pen = new Pen(color, width))
                {
                    graphics.DrawEllipse(pen, rect);
                }
            }
            else
            {
                Rectangle      rect      = new Rectangle(1, 1, item.Width - 4, item.Height - 3);
                RoundRectangle roundRect = new RoundRectangle(rect, ItemCornerRadius);
                if (item.Selected || item.Pressed)
                {
                    GDIHelper.FillRectangle(graphics, roundRect, SkinManager.CurrentSkin.HeightLightControlColor);
                    GDIHelper.DrawPathBorder(graphics, roundRect);
                }
            }
        }
Example #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();
        }