Files
docs-desktop/dotnet-desktop-guide/framework/winforms/controls/how-to-implement-a-custom-toolstriprenderer.md
T
Andy De George c0ba284473 Initial winforms content migrated (#18)
* Merge winforms framework content to working branch (#14)

* Breadcrumb / TOC / Move net5 to net folder (#15)

* change path from net5 to net

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Add .net 5 winforms placeholder article (#16)

* added some metadata and adjusted net5 placeholder

* corrections

* corrections

* corrections

* Test1

* Swapping landing page vs concept

* fix links

* Fix links

* Fix desc
2020-09-01 16:26:21 -07:00

2.3 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Implement a Custom ToolStripRenderer 03/30/2017
csharp
vb
toolbars [Windows Forms]
ToolStrip control [Windows Forms]
c66fd3f7-2377-4553-8f1b-006527f08f32

How to: Implement a Custom ToolStripRenderer

You can customize the appearance of a xref:System.Windows.Forms.ToolStrip control by implementing a class that derives from xref:System.Windows.Forms.ToolStripRenderer. This gives you the flexibility to create an appearance that differs from the appearance provided the xref:System.Windows.Forms.ToolStripProfessionalRenderer and xref:System.Windows.Forms.ToolStripSystemRenderer classes.

Example

The following code example demonstrates how to implement a custom xref:System.Windows.Forms.ToolStripRenderer class. In this example, the GridStrip control implements a sliding-tile puzzle, which allows the user to move tiles in a table layout to form an image. A custom xref:System.Windows.Forms.ToolStrip control arranges its xref:System.Windows.Forms.ToolStripButton controls in a grid layout. The layout contains one empty cell, into which the user can slide an adjacent tile by using a drag-and-drop operation. Tiles that the user can move are highlighted.

The GridStripRenderer class customizes three aspects of the GridStrip control's appearance:

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

Compiling the Code

This example requires:

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

See also