Changing the Appearance of the Windows Forms TabControl
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
- Add an ImageList control to the form.
- 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.
- Set the ImageList property of the TabControl to the ImageList control.
- Set the ImageIndex property of the TabPage object to the index of an appropriate image in the list.
To create multiple rows of tabs
- Add the desired number of tab pages.
- Set the Multiline property of the TabControl to true.
- 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.