Handles the painting functionality for ToolStrip objects.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
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 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.