Export (0) Print
Expand All

TabControl.DrawItem Event

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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft