Permalink
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (47 sloc) 3.68 KB
title ms.custom ms.date ms.prod ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
How to: Set the ToolStrip Renderer for an Application
03/30/2017
.net-framework
dotnet-winforms
article
jsharp
Renderer property [Windows Forms]
ToolStripProfessionalRenderer class [Windows Forms]
ToolStrip control [Windows Forms]
MenuStrip control [Windows Forms]
toolbars [Windows Forms], customizing
46acef3e-9844-4ae8-9a2e-3006fe99cadf
9
dotnet-bot
dotnetcontent
wpickett

How to: Set the ToolStrip Renderer for an Application

You can customize the appearance of your xref:System.Windows.Forms.ToolStrip controls individually or for all the xref:System.Windows.Forms.ToolStrip controls in your application.

Example

The following code example demonstrates how to selectively apply a custom renderer to a xref:System.Windows.Forms.ToolStrip control and a xref:System.Windows.Forms.MenuStrip control.

To use this code example, compile and run the application, and then select the scope of the custom rending from the xref:System.Windows.Forms.ComboBox control. Click Apply to set the renderer.

To see custom menu item rendering, select the xref:System.Windows.Forms.MenuStrip option from the xref:System.Windows.Forms.ComboBox control, click Apply, and then open the File menu item.

[!code-csharpSystem.Windows.Forms.ToolStrip.Misc#1] [!code-vbSystem.Windows.Forms.ToolStrip.Misc#1]
[!code-csharpSystem.Windows.Forms.ToolStrip.Misc#70] [!code-vbSystem.Windows.Forms.ToolStrip.Misc#70]

Set the xref:System.Windows.Forms.ToolStripManager.Renderer%2A?displayProperty=nameWithType property to apply a custom renderer to all the xref:System.Windows.Forms.ToolStrip controls in your application.

Set the xref:System.Windows.Forms.ToolStrip.Renderer%2A?displayProperty=nameWithType property to apply a custom renderer to an individual xref:System.Windows.Forms.ToolStrip control.

Compiling the Code

This example requires:

  • References to the System.Design, System.Drawing, and System.Windows.Forms assemblies.

For information about building this example from the command line for [!INCLUDEvbprvb] or [!INCLUDEcsprcs], see Building from the Command Line or Command-line Building With csc.exe. You can also build this example in [!INCLUDEvsprvs] by pasting the code into a new project. Also see How to: Compile and Run a Complete Windows Forms Code Example Using Visual Studio.

See Also

xref:System.Windows.Forms.ToolStripManager
xref:System.Windows.Forms.MenuStrip
xref:System.Windows.Forms.ToolStrip
xref:System.Windows.Forms.ToolStripProfessionalRenderer
ToolStrip Control