예제 #1
0
        protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)

        {
            Color     baseColor = ColorTable.BackColorNormal;
            ToolStrip toolStrip = e.ToolStrip;
            Graphics  g         = e.Graphics;

            g.SmoothingMode = SmoothingMode.AntiAlias;

            if (toolStrip is ToolStripDropDown)
            {
                RegionHelper.SetControlRegion(e.ToolStrip, e.AffectedBounds);

                Rectangle rect = e.AffectedBounds;

                using (GraphicsPath path = GraphicsPathHelper.CreateFilletRectangle(
                           rect, 8, RoundStyle.All, false))
                {
                    using (SolidBrush brush = new SolidBrush(ColorTable.BackColorNormal))
                    {
                        g.FillPath(brush, path);
                    }
                    using (Pen pen = new Pen(ColorTable.BorderColor))
                    {
                        g.DrawPath(pen, path);

                        using (GraphicsPath innerPath = GraphicsPathHelper.CreateFilletRectangle(
                                   rect, 8, RoundStyle.All, true))
                        {
                            g.DrawPath(pen, innerPath);
                        }
                    }
                }
            }
            else
            {
                LinearGradientMode mode =
                    e.ToolStrip.Orientation == Orientation.Horizontal ?
                    LinearGradientMode.Vertical : LinearGradientMode.Horizontal;
                RenderBackgroundInternal(
                    g,
                    e.AffectedBounds,
                    ColorTable.BackColorHover,
                    ColorTable.BorderColor,
                    ColorTable.BackColorNormal,
                    RoundStyle.All,
                    false,
                    true,
                    mode);
            }
        }
        protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
        {
            ToolStrip toolStrip = e.ToolStrip;
            Graphics  g         = e.Graphics;
            Rectangle bounds    = e.AffectedBounds;

            if (toolStrip is ToolStripDropDown)
            {
                RegionHelper.SetControlRegion(toolStrip, bounds);
                using (SolidBrush brush = new SolidBrush(ColorTable.BackNormal))
                {
                    g.FillRectangle(brush, bounds);
                }
            }
            else if (toolStrip is MenuStrip)
            {
                LinearGradientMode mode =
                    toolStrip.Orientation == Orientation.Horizontal ?
                    LinearGradientMode.Vertical : LinearGradientMode.Horizontal;
                RenderHelper.RenderBackgroundInternal(
                    g,
                    bounds,
                    ColorTable.Base,
                    ColorTable.Border,
                    ColorTable.BackNormal,
                    RoundStyle.None,
                    0,
                    .35f,
                    false,
                    false,
                    mode);
            }
            else
            {
                base.OnRenderToolStripBackground(e);
            }
        }