Export (0) Print
Expand All

Changing the Appearance of the Windows Forms TabControl

Visual Studio .NET 2003

The appearance of tabs in Windows Forms can be changed using properties of the TabControl and the TabPage objects that make up the individual tabs on the control. By setting these properties, you can display images on tabs, display tabs vertically instead of horizontally, have multiple rows of tabs, and enable or disable tabs programmatically.

To display an icon on the label part of a tab

  1. Add an ImageList control to the form.
  2. Add images to the image list. For more information about image lists, see Introduction to the Windows Forms ImageList Component and Adding or Removing Images with the Windows Forms ImageList Component.
  3. Set the ImageList property of the TabControl to the ImageList control.
  4. Set the ImageIndex property of the TabPage object to the index of an appropriate image in the list.

To create multiple rows of tabs

  1. Add the desired number of tab pages.
  2. Set the Multiline property of the TabControl to true.
  3. If the tabs do not already appear in multiple rows, set the Width property of the TabControl to be narrower than all the tabs.

To arrange tabs on the side of the control

  • Set the Alignment property of the TabControl to Left or Right.

To enable or disable tabs programmatically

  • Set the Enabled property of the TabPage object to true or false.
    ' Visual Basic
    TabPage1.Enabled = False
    
    // C#
    tabPage1.Enabled = false;
    
    // C++
    tabPage1->Enabled = false;
    

To display tabs as buttons

  • Set the Appearance property of the TabControl to Buttons or FlatButtons.

See Also

Introduction to the Windows Forms TabControl | Adding a Control to a Tab Page | Disabling Tab Pages Programmatically | Adding and Removing Tabs with the Windows Forms TabControl

Show:
© 2014 Microsoft