TabControl.DrawMode Property

 
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.

Gets or sets the way that the control's tabs are drawn.

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

member DrawMode : TabDrawMode with get, set

Property Value

Type: System.Windows.Forms.TabDrawMode

One of the TabDrawMode values. The default is Normal.

Exception Condition
InvalidEnumArgumentException

The property value is not a valid TabDrawMode value.

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.

The following code example creates a TabControl with one TabPage. This example sets the DrawMode property to OwnerDrawFixed, which specifies that the tabs are drawn by the parent object Form1. The value OwnerDrawFixed also enables access to the DrawItem event, which, in this example, is used to draw myTabRect on the tabPage1 tab.

Use the System.Drawing and System.Windows.Forms namespaces with 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: