
ProfessionalColorTable colorTable = new ProfessionalColorTable() ĭim colorTable As New ProfessionalColorTable Use code similar to the following code example. Turn off the Office colors for one ToolStrip
Set ToolStripManager.VisualStylesEnabled to false. Use ToolStripManager.Renderer to assign a custom renderer.Įnsure that ToolStrip.RenderMode is set to the default value of ManagerRenderMode. Use the ToolStripManager.RenderMode property to choose one of the provided renderers. Public Overrides ReadOnly Property ButtonSelectedGradientEnd() As Public Overrides ReadOnly Property ButtonSelectedGradientMiddle() As Public Overrides ReadOnly Property ButtonSelectedGradientBegin() As Public Overrides ReadOnly Property ButtonPressedGradientEnd() As Public Overrides ReadOnly Property ButtonPressedGradientMiddle() As Public Overrides ReadOnly Property ButtonPressedGradientBegin() As ToolStrip1.Renderer = New ToolStripProfessionalRenderer(colorTable) Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Public override ButtonSelectedGradientEnd => Color.Violet Public override ButtonSelectedGradientMiddle => Color.Orange Public override ButtonSelectedGradientBegin => Color.Yellow Public override ButtonPressedGradientEnd => Color.Green Public override ButtonPressedGradientMiddle => Color.Blue Public override ButtonPressedGradientBegin => Color.Red ToolStrip1.Renderer = new ToolStripProfessionalRenderer(colorTable) Ĭlass M圜olorTable: ProfessionalColorTable Private void Form1_Load(object sender, EventArgs e) Override ProfessionalColorTable and change the colors you want. There is a version of this method for ToolStripRenderer, ToolStripSystemRenderer, and ToolStripProfessionalRenderer. Override ToolStripProfessionalRenderer.OnRenderToolStripBorder, but do not call the base class. The other values of ToolStripRenderMode are Custom, Professional, and System. With ManagerRenderMode, the static RenderMode determines the renderer for your application.
Set the RenderMode property to the ToolStripRenderMode value you want. The following procedures describe various aspects of custom drawing. To custom draw (also known as owner draw) a ToolStrip, you can override one of the renderer classes and change an aspect of the rendering logic. ToolStripRenderer is the abstract base class for the other two rendering classes. ToolStripProfessionalRenderer provides the appearance and style of Microsoft Office.
ToolStripSystemRenderer provides the appearance and style of your operating system. The ToolStrip controls have the following associated rendering (painting) classes: