protected override void OnRenderImageMargin(ToolStripRenderEventArgs e) { ToolStrip toolStrip = e.ToolStrip; Graphics g = e.Graphics; GDIHelper.InitializeGraphics(g); Rectangle rect = e.AffectedBounds; rect.Width -= 1; rect.Height -= 1; if (toolStrip is ToolStripDropDown) { rect.Width = this._OffsetMargin; Color c = this.MenuImageMarginBackColor; CornerRadius toolStripCornerRadius = new CornerRadius(this.MenuCornerRadius); RoundRectangle roundRect = new RoundRectangle(rect, toolStripCornerRadius); GDIHelper.FillPath(g, new RoundRectangle(rect, new CornerRadius(this.MenuCornerRadius, 0, this.MenuCornerRadius, 0)), c, c); Image img = this.MenuImageBackImage; if (img != null && this.ShowMenuBackImage) { ImageAttributes imgAttributes = new ImageAttributes(); GDIHelper.SetImageOpacity(imgAttributes, this.MenuImageBackImageOpacity); g.DrawImage(Properties.Resources.logo_mini, new Rectangle(rect.X + 1, rect.Y + 2, img.Width, img.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, imgAttributes); } ////绘制间隔线 Point p1, p2; p1 = new Point(rect.X + this._OffsetMargin, rect.Y + 3); p2 = new Point(rect.X + this._OffsetMargin, rect.Bottom - 3); using (Pen pen = new Pen(SkinManager.CurrentSkin.BorderColor)) { g.DrawLine(pen, p1, p2); } } else { base.OnRenderImageMargin(e); } }