Exemplo n.º 1
0
        protected override void OnRenderImageMargin(ToolStripRenderEventArgs e)
        {
            ToolStrip toolStrip = e.ToolStrip;
            Graphics  graphics  = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            Rectangle affectedBounds = e.AffectedBounds;

            affectedBounds.Width--;
            affectedBounds.Height--;
            if (toolStrip is ToolStripDropDown)
            {
                affectedBounds.Width = _OffsetMargin;
                Color          menuImageMarginBackColor = MenuImageMarginBackColor;
                RoundRectangle roundRectangle           = new RoundRectangle(cornerRadius: new CornerRadius(MenuCornerRadius), rect: affectedBounds);
                GDIHelper.FillPath(graphics, new RoundRectangle(affectedBounds, new CornerRadius(MenuCornerRadius, 0, MenuCornerRadius, 0)), menuImageMarginBackColor, menuImageMarginBackColor);
                Image menuImageBackImage = MenuImageBackImage;
                if (menuImageBackImage != null && ShowMenuBackImage)
                {
                    ImageAttributes imageAttributes = new ImageAttributes();
                    GDIHelper.SetImageOpacity(imageAttributes, MenuImageBackImageOpacity);
                    graphics.DrawImage(Resources.logo_mini, new Rectangle(affectedBounds.X + 1, affectedBounds.Y + 2, menuImageBackImage.Width, menuImageBackImage.Height), 0, 0, menuImageBackImage.Width, menuImageBackImage.Height, GraphicsUnit.Pixel, imageAttributes);
                }
                Point pt  = new Point(affectedBounds.X + _OffsetMargin, affectedBounds.Y + 3);
                Point pt2 = new Point(affectedBounds.X + _OffsetMargin, affectedBounds.Bottom - 3);
                using (Pen pen = new Pen(SkinManager.CurrentSkin.BorderColor))
                {
                    graphics.DrawLine(pen, pt, pt2);
                }
            }
            else
            {
                base.OnRenderImageMargin(e);
            }
        }