Handles the painting functionality for ToolStrip objects.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Thetype exposes the following members.
|RenderArrow||Occurs when an arrow on a ToolStripItem is rendered.|
|RenderButtonBackground||Occurs when the background for a ToolStripButton is rendered|
|RenderDropDownButtonBackground||Occurs when the background for a ToolStripDropDownButton is rendered.|
|RenderGrip||Occurs when the move handle for a ToolStrip is rendered.|
|RenderImageMargin||Draws the margin between an image and its container.|
|RenderItemBackground||Occurs when the background for a ToolStripItem is rendered.|
|RenderItemCheck||Occurs when the image for a selected ToolStripItem is rendered.|
|RenderItemImage||Occurs when the image for a ToolStripItem is rendered.|
|RenderItemText||Occurs when the text for a ToolStripItem is rendered.|
|RenderLabelBackground||Occurs when the background for a ToolStripLabel is rendered.|
|RenderMenuItemBackground||Occurs when the background for a ToolStripMenuItem is rendered.|
|RenderOverflowButtonBackground||Occurs when the background for an overflow button is rendered.|
|RenderSeparator||Occurs when a ToolStripSeparator is rendered.|
|RenderSplitButtonBackground||Occurs when the background for a ToolStripSplitButton is rendered.|
|RenderStatusStripSizingGrip||Occurs when the display style changes.|
|RenderToolStripBackground||Occurs when the background for a ToolStrip is rendered.|
|RenderToolStripBorder||Occurs when the border for a ToolStrip is rendered.|
|RenderToolStripContentPanelBackground||Draws the background of a ToolStripContentPanel.|
|RenderToolStripPanelBackground||Draws the background of a ToolStripPanel.|
|RenderToolStripStatusLabelBackground||Draws the background of a ToolStripStatusLabel.|
Use the class to apply a particular style or theme to a ToolStrip. Rather than custom painting a ToolStrip and the ToolStripItem objects it contains, you set the ToolStrip.Renderer property to an object that inherits from . The painting specified by the is applied to the ToolStrip, as well as the items it contains.
You can do custom painting in ToolStrip controls in several ways. As with other Windows Forms controls, the ToolStrip and ToolStripItem both have overridable OnPaint methods and Paint events. As with regular painting, the coordinate system is relative to the client area of the control; that is, the upper left-hand corner of the control is 0, 0. The Paint event and OnPaint method for a ToolStripItem behave like other control paint events.
The class has overridable methods for painting the background, item background, item image, item arrow, item text, and border of the ToolStrip. The event arguments for these methods expose several properties such as rectangles, colors, and text formats that you can adjust as desired.
To adjust just a few aspects of how an item is painted, you typically override the .
If you are writing a new item and want to control all aspects of the painting, override the OnPaint method. From within OnPaint, you can use methods from the .
The following code example demonstrates how to implement a custom class. The GridStripRenderer class customizes three aspects of the GridStrip control's appearance: GridStrip border, ToolStripButton border, and ToolStripButton image. For a full code listing, see How to: Implement a Custom ToolStripRenderer.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.