TabControl.DrawItem Event

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Occurs when the TabControl needs to paint each of its tabs if the DrawMode property is set to OwnerDrawFixed.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member DrawItem : IEvent<DrawItemEventHandler,
    DrawItemEventArgs>

When you set the DrawMode property to OwnerDrawFixed, the TabControl raises the DrawItem event whenever it needs to paint one of its tabs. To customize the appearance of the tabs, provide your own painting code in a handler for the DrawItem event.

The TabControl does not support variable tab sizes with owner drawing.

For more information about handling events, see Handling and Raising Events.

The following code example creates a TabControl with one TabPage. This example declares an event handler that is used to draw a string and Rectangle on the tab of tabPage1. The event handler is bound to the DrawItem event.

Use the System.Drawing and System.Windows.Forms namespaces for this example.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: