protected override void OnRenderImageMargin(ToolStripRenderEventArgs e) { e.Graphics.Clear(ColorScheme.FormBackColor); }
// This method handles the RenderToolStripBorder event. protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { DrawTitleBar( e.Graphics, new Rectangle(0, 0, e.ToolStrip.Width, 7)); }
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { ActualRenderer.DrawToolStripBorder(e); }
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { // No border }
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { }
public virtual void OnRenderToolStripBackground (ToolStripRenderEventArgs e) { if (e.ToolStrip.BackgroundImage == null) e.Graphics.Clear (e.BackColor); if (e.ToolStrip is StatusStrip) e.Graphics.DrawLine (Pens.White, e.AffectedBounds.Left, e.AffectedBounds.Top, e.AffectedBounds.Right, e.AffectedBounds.Top); }
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { base.OnRenderToolStripBorder(e); ControlPaint.DrawBorder(e.Graphics, e.AffectedBounds, Color.FromArgb(51, 171, 210), ButtonBorderStyle.Solid); }
public void DrawStatusStripSizingGrip(ToolStripRenderEventArgs e) { }
protected override void OnRenderStatusStripSizingGrip(ToolStripRenderEventArgs e) { this.renderer.DrawStatusStripSizingGrip(e); }
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) { base.OnRenderToolStripBackground(e); e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(35, 36, 37)), e.ToolStrip.ClientRectangle); }
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { if (PaintMenuBorder != null) { PaintMenuBorder(this, e); } }
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) { if (PaintMenuBackground != null) { PaintMenuBackground(this, e); } }
protected override void OnRenderImageMargin(ToolStripRenderEventArgs e) { if (PaintMenuImageMargin != null) { PaintMenuImageMargin(this, e); } }
/// <summary> /// Raises the RenderToolStripBackground event. /// </summary> /// <param name="e">An ToolStripRenderEventArgs containing the event data.</param> protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) { if (ColorTable.UseSystemColors == true) { base.OnRenderToolStripBackground(e); } else { Trace.WriteLine("ToolStrip: " + e.ToolStrip.GetType()); Rectangle backgroundRectangle = new Rectangle(0, 0, e.ToolStrip.Width, e.ToolStrip.Height); Rectangle innerRectangle = backgroundRectangle; innerRectangle.Height = (backgroundRectangle.Height / 2) + 1; // Cannot paint a zero sized area if ((backgroundRectangle.Width > 0) && (backgroundRectangle.Height > 0)) { if (e.ToolStrip is StatusStrip) { using (SolidBrush outerBrush = new SolidBrush(ColorTable.StatusStripGradientEnd)) { e.Graphics.FillRectangle(outerBrush, backgroundRectangle); } int y2 = backgroundRectangle.Height / 2; Rectangle upperRectangle = new Rectangle(backgroundRectangle.X, backgroundRectangle.Y, backgroundRectangle.Width, y2); upperRectangle.Height += 1; using (LinearGradientBrush innerRectangleBrush = new LinearGradientBrush( upperRectangle, ColorTable.StatusStripGradientBegin, Color.FromArgb(128, ColorTable.StatusStripGradientBegin), LinearGradientMode.Vertical)) { e.Graphics.FillRectangle(innerRectangleBrush, upperRectangle); //draw top bubble } y2 = (backgroundRectangle.Height / 4) + 1; Rectangle lowerRectangle = new Rectangle(backgroundRectangle.X, backgroundRectangle.Height - y2, backgroundRectangle.Width, y2); using (LinearGradientBrush innerRectangleBrush = new LinearGradientBrush( lowerRectangle, ColorTable.StatusStripGradientEnd, Color.FromArgb(128, ColorTable.StatusStripGradientBegin), LinearGradientMode.Vertical)) { e.Graphics.FillRectangle(innerRectangleBrush, lowerRectangle); //draw top bubble } } else if (e.ToolStrip is MenuStrip) { using (SolidBrush outerBrush = new SolidBrush(ColorTable.MenuStripGradientEnd)) { e.Graphics.FillRectangle(outerBrush, backgroundRectangle); } int y2 = backgroundRectangle.Height / 3; Rectangle lowerRectangle = new Rectangle(backgroundRectangle.X, backgroundRectangle.Y, backgroundRectangle.Width, y2); using (LinearGradientBrush innerRectangleBrush = new LinearGradientBrush( lowerRectangle, ColorTable.MenuStripGradientBegin, Color.FromArgb(128, ColorTable.StatusStripGradientBegin), LinearGradientMode.Vertical)) { e.Graphics.FillRectangle(innerRectangleBrush, lowerRectangle); //draw top bubble } } else if (e.ToolStrip is ToolStripDropDown) { base.OnRenderToolStripBackground(e); } else { using (SolidBrush outerBrush = new SolidBrush(ColorTable.ToolStripGradientEnd)) { e.Graphics.FillRectangle(outerBrush, backgroundRectangle); } int y2 = backgroundRectangle.Height / 2; Rectangle upperRectangle = new Rectangle(backgroundRectangle.X, backgroundRectangle.Y, backgroundRectangle.Width, y2); using (LinearGradientBrush innerRectangleBrush = new LinearGradientBrush( upperRectangle, ColorTable.ToolStripGradientBegin, ColorTable.ToolStripGradientMiddle, LinearGradientMode.Vertical)) { e.Graphics.FillRectangle(innerRectangleBrush, upperRectangle); //draw top bubble } y2 = backgroundRectangle.Height / 4; Rectangle lowerRectangle = new Rectangle(backgroundRectangle.X, backgroundRectangle.Height - y2, backgroundRectangle.Width, y2); using (LinearGradientBrush innerRectangleBrush = new LinearGradientBrush( lowerRectangle, ColorTable.ToolStripGradientEnd, ColorTable.ToolStripGradientMiddle, LinearGradientMode.Vertical)) { e.Graphics.FillRectangle(innerRectangleBrush, lowerRectangle); //draw top bubble } } } } }
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { Color c = SystemColors.AppWorkspace; if (UseVS) { VisualStyleRenderer rndr = new VisualStyleRenderer(VisualStyleElement.Tab.Pane.Normal); c = rndr.GetColor(ColorProperty.BorderColorHint); } using (Pen p = new Pen(c)) using (Pen p2 = new Pen(e.BackColor)) { Rectangle r = e.ToolStrip.Bounds; int x1 = (Mirrored) ? 0 : r.Width - 1 - e.ToolStrip.Padding.Horizontal; int y1 = (Mirrored) ? 0 : r.Height - 1; if (e.ToolStrip.Orientation == Orientation.Horizontal) { e.Graphics.DrawLine(p, 0, y1, r.Width, y1); } else { e.Graphics.DrawLine(p, x1, 0, x1, r.Height); if (!Mirrored) { for (int i = x1 + 1; i < r.Width; i++) { e.Graphics.DrawLine(p2, i, 0, i, r.Height); } } } foreach (ToolStripItem x in e.ToolStrip.Items) { if (x.IsOnOverflow) { continue; } TabStripButton btn = x as TabStripButton; if (btn == null) { continue; } Rectangle rc = btn.Bounds; int x2 = (Mirrored) ? rc.Left : rc.Right; int y2 = (Mirrored) ? rc.Top : rc.Bottom - 1; int addXY = (Mirrored) ? 0 : 1; if (e.ToolStrip.Orientation == Orientation.Horizontal) { e.Graphics.DrawLine(p, rc.Left, y2, rc.Right, y2); if (btn.Checked) { e.Graphics.DrawLine(p2, rc.Left + 2 - addXY, y2, rc.Right - 2 - addXY, y2); } } else { e.Graphics.DrawLine(p, x2, rc.Top, x2, rc.Bottom); if (btn.Checked) { e.Graphics.DrawLine(p2, x2, rc.Top + 2 - addXY, x2, rc.Bottom - 2 - addXY); } } } } }
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) { //判断ToolStrip的类型 ToolStrip tsType = e.ToolStrip; Graphics g = e.Graphics; //抗锯齿 g.SmoothingMode = SmoothingMode.HighQuality; if (tsType is MenuStrip || tsType is ToolStripDropDown) { //指定填充Menu栏与ToolBar栏的背景色的画刷,使用线性渐变画刷 LinearGradientBrush lgBursh = new LinearGradientBrush(new Point(0, 0), new Point(0, tsType.Height), Color.FromArgb(255, Color.White), Color.FromArgb(150, menu_color)); GraphicsPath path = new GraphicsPath(FillMode.Winding); int diameter = 10;//直径 Rectangle rect = new Rectangle(Point.Empty, tsType.Size); Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter)); path.AddLine(0, 0, 10, 0); // 右上角 arcRect.X = rect.Right - diameter; path.AddArc(arcRect, 270, 90); // 右下角 arcRect.Y = rect.Bottom - diameter; path.AddArc(arcRect, 0, 90); // 左下角 arcRect.X = rect.Left; path.AddArc(arcRect, 90, 90); path.CloseFigure(); //设置控件的窗口区域 tsType.Region = new Region(path); //填充窗口区域 g.FillPath(lgBursh, path); } else if (tsType is ToolStrip) { //指定填充Menu栏与ToolBar栏的背景色的画刷,使用线性渐变画刷 LinearGradientBrush lgBursh = new LinearGradientBrush(new Point(0, 0), new Point(0, tsType.Height), Color.FromArgb(255, Color.White), Color.FromArgb(150, toolbar_color)); GraphicsPath path = new GraphicsPath(FillMode.Winding); int diameter = 10;//直径 Rectangle rect = new Rectangle(Point.Empty, tsType.Size); Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter)); path.AddLine(0, 0, 10, 0); // 右上角 arcRect.X = rect.Right - diameter; path.AddArc(arcRect, 270, 90); // 右下角 arcRect.Y = rect.Bottom - diameter; path.AddArc(arcRect, 0, 90); // 左下角 arcRect.X = rect.Left; path.AddArc(arcRect, 90, 90); path.CloseFigure(); //设置控件的窗口区域 tsType.Region = new Region(path); //填充窗口区域 g.FillPath(lgBursh, path); } else { base.OnRenderToolStripBackground(e); } }
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { // Don't draw a border }
public void DrawToolStripBorder(ToolStripRenderEventArgs e) { }
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { return; }
protected override void OnRenderImageMargin(ToolStripRenderEventArgs e) { if (this.EnsureRenderer()) { if (e.ToolStrip.IsDropDown) { this.Renderer.SetParameters(this.MenuClass, (int)MenuParts.PopupGutter, 0); // The AffectedBounds is usually too small, way too small to look right. Instead of using that, // use the AffectedBounds but with the right width. Then narrow the rectangle to the correct edge // based on whether or not it's RTL. //(It doesn't need to be narrowed to an edge in LTR mode, but let's do that anyway.) // Using the DisplayRectangle gets roughly the right size so that the separator is closer to the text. Padding margins = this.GetThemeMargins(e.Graphics, MarginTypes.Sizing); int extraWidth = (e.ToolStrip.Width - e.ToolStrip.DisplayRectangle.Width - margins.Left - margins.Right - 1) - e.AffectedBounds.Width; Rectangle rect = e.AffectedBounds; rect.Y += 2; rect.Height -= 4; int sepWidth = this.Renderer.GetPartSize(e.Graphics, ThemeSizeType.True).Width; if (e.ToolStrip.RightToLeft == RightToLeft.Yes) { rect = new Rectangle(rect.X - extraWidth, rect.Y, sepWidth, rect.Height); rect.X += sepWidth; } else { rect = new Rectangle(rect.Width + extraWidth - sepWidth, rect.Y, sepWidth, rect.Height); } this.Renderer.DrawBackground(e.Graphics, rect); } } else { base.OnRenderImageMargin(e); } }
//渲染边框 不绘制边框 protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { //不调用基类的方法 屏蔽掉该方法 去掉边框 }
private void Renderer_PaintMenuBorder(object sender, ToolStripRenderEventArgs e) { G = e.Graphics; using (Pen Border = new Pen(Color.FromArgb(42, 42, 41))) { G.DrawRectangle(Border, new Rectangle(e.AffectedBounds.X, e.AffectedBounds.Y, e.AffectedBounds.Width - 1, e.AffectedBounds.Height - 1)); } }
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { e.Graphics.DrawRectangle(Pens.Black, e.AffectedBounds.X, e.AffectedBounds.Y, e.AffectedBounds.Width - 1, e.AffectedBounds.Height - 1); base.OnRenderToolStripBorder(e); }
} // Constructor to allow the creation of an instance of an object of this class. protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { } // Override the strip border method from the original toolstrip renderer intended for drawing the border with empty code.
public void DrawToolStripBackground(ToolStripRenderEventArgs e) { }
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) { // No background }
public void DrawImageMargin(ToolStripRenderEventArgs e) { }
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) { e.Graphics.Clear(ColorScheme.FormBackColor); }
protected override void OnRenderImageMargin(ToolStripRenderEventArgs e) { //e.Graphics.FillRectangle(new SolidBrush(ControlPaint.Light(ColorTable.BaseBackColor, .05f)), e.AffectedBounds); }
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { //判断ToolStrip的类型 ToolStrip tsType = e.ToolStrip; Graphics g = e.Graphics; //抗锯齿 g.SmoothingMode = SmoothingMode.HighQuality; if (tsType is MenuStrip || tsType is ToolStripDropDown) { //设置画笔 Pen LinePen = new Pen(menu_color); GraphicsPath path = new GraphicsPath(FillMode.Winding); int diameter = 10;//直径 Rectangle rect = new Rectangle(Point.Empty, tsType.Size); Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter)); path.AddLine(0, 0, 10, 0); // 右上角 arcRect.X = rect.Right - diameter; path.AddArc(arcRect, 270, 90); // 右下角 arcRect.Y = rect.Bottom - diameter; path.AddArc(arcRect, 0, 90); // 左下角 arcRect.X = rect.Left; path.AddArc(arcRect, 90, 90); path.CloseFigure(); //画边框 g.DrawPath(LinePen, path); } else if (tsType is ToolStrip) { //设置画笔 Pen LinePen = new Pen(toolbar_color); GraphicsPath path = new GraphicsPath(FillMode.Winding); int diameter = 10;//直径 Rectangle rect = new Rectangle(Point.Empty, tsType.Size); Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter)); path.AddLine(0, 0, 10, 0); // 右上角 arcRect.X = rect.Right - diameter; path.AddArc(arcRect, 270, 90); // 右下角 arcRect.Y = rect.Bottom - diameter; path.AddArc(arcRect, 0, 90); // 左下角 arcRect.X = rect.Left; path.AddArc(arcRect, 90, 90); path.CloseFigure(); //画边框 g.DrawPath(LinePen, path); } else { base.OnRenderToolStripBorder(e); } }
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { e.Graphics.DrawRectangle(new Pen(this.SkinManager.GetDividersColor()), new Rectangle(e.AffectedBounds.X, e.AffectedBounds.Y, e.AffectedBounds.Width - 1, e.AffectedBounds.Height - 1)); }
protected override void OnRenderImageMargin(ToolStripRenderEventArgs e) { //base.OnRenderImageMargin(e); }
protected override void OnRenderImageMargin( ToolStripRenderEventArgs e) { if (e.ToolStrip is ToolStripDropDownMenu) { Rectangle rect = e.AffectedBounds; Graphics g = e.Graphics; rect.Width = OffsetMargin; if (e.ToolStrip.RightToLeft == RightToLeft.Yes) { rect.X -= 2; } else { rect.X += 2; } rect.Y += 1; rect.Height -= 2; g.SmoothingMode = SmoothingMode.AntiAlias; using (LinearGradientBrush brush = new LinearGradientBrush( rect, ColorTable.BackColorHover, Color.White, 90f)) { Blend blend = new Blend(); blend.Positions = new float[] { 0f, .2f, 1f }; blend.Factors = new float[] { 0f, 0.1f, .9f }; brush.Blend = blend; rect.Y += 1; rect.Height -= 2; using (GraphicsPath path = GraphicsPathHelper.CreatePath(rect, 8, RoundStyle.All, false)) { g.FillPath(brush, path); } } g.TextRenderingHint = TextRenderingHint.AntiAlias; StringFormat sf = new StringFormat(StringFormatFlags.NoWrap); Font font = new Font( e.ToolStrip.Font.FontFamily, 11, FontStyle.Bold); sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Center; sf.Trimming = StringTrimming.EllipsisCharacter; g.TranslateTransform(rect.X, rect.Bottom); g.RotateTransform(270f); if (!string.IsNullOrEmpty(MenuLogoString)) { Rectangle newRect = new Rectangle( rect.X, rect.Y, rect.Height, rect.Width); using (Brush brush = new SolidBrush(ColorTable.ForeColor)) { g.DrawString( MenuLogoString, font, brush, newRect, sf); } } g.ResetTransform(); return; } base.OnRenderImageMargin(e); }
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { ControlPaint.DrawBorder(e.Graphics, e.AffectedBounds, Color.FromArgb(160, 175, 195), ButtonBorderStyle.Solid); }
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { //base.OnRenderToolStripBorder(e); }
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { if (this.EnsureRenderer()) { this.Renderer.SetParameters(this.MenuClass, (int)MenuParts.PopupBorders, 0); if (e.ToolStrip.IsDropDown) { Region oldClip = e.Graphics.Clip; // Tool strip borders are rendered *after* the content, for some reason. // So we have to exclude the inside of the popup otherwise we'll draw over it. Rectangle insideRect = e.ToolStrip.ClientRectangle; insideRect.Inflate(-1, -1); e.Graphics.ExcludeClip(insideRect); Renderer.DrawBackground(e.Graphics, e.ToolStrip.ClientRectangle, e.AffectedBounds); // Restore the old clip in case the Graphics is used again (does that ever happen?) e.Graphics.Clip = oldClip; } } else { base.OnRenderToolStripBorder(e); } }
protected override void OnRenderImageMargin(ToolStripRenderEventArgs e) { ActualRenderer.DrawImageMargin(e); }
public override void OnRenderToolStripBackground (ToolStripRenderEventArgs e) { if (e.ToolStrip.BackgroundImage != null) return; if (!ThemeVisualStyles.RenderClientAreas) { base.OnRenderToolStripBackground (e); return; } VisualStyleElement element; if (e.ToolStrip is StatusStrip) element = VisualStyleElement.Status.Bar.Normal; else element = VisualStyleElement.Rebar.Band.Normal; if (!VisualStyleRenderer.IsElementDefined (element)) { base.OnRenderToolStripBackground (e); return; } new VisualStyleRenderer (element).DrawBackground (e.Graphics, e.ToolStrip.Bounds, e.AffectedBounds); }
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) { ActualRenderer.DrawToolStripBackground(e); }
public virtual void OnRenderToolStripBorder (ToolStripRenderEventArgs e) { if (e.ToolStrip is StatusStrip) return; if (e.ToolStrip is ToolStripDropDown) ControlPaint.DrawBorder3D (e.Graphics, e.AffectedBounds, Border3DStyle.Raised); else { e.Graphics.DrawLine (SystemPens.ControlDark, new Point (e.ToolStrip.Left, e.ToolStrip.Height - 2), new Point (e.ToolStrip.Right, e.ToolStrip.Height - 2)); e.Graphics.DrawLine (Pens.White, new Point (e.ToolStrip.Left, e.ToolStrip.Height - 1), new Point (e.ToolStrip.Right, e.ToolStrip.Height - 1)); } }
private void Renderer_PaintMenuBackground(object sender, ToolStripRenderEventArgs e) { G = e.Graphics; G.Clear(Color.FromArgb(44, 44, 43)); }