共用方式為


How to: Change the Appearance of the Windows Forms TabControl

You can change the appearance of tabs in Windows Forms by 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, display 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 ImageList Component (Windows Forms) and How to: Add or Remove 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 to the index of an appropriate image in the list.

To create multiple rows of tabs

  1. Add the number of tab pages you want.

  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

To enable or disable tabs programmatically

  • Set the Enabled property of the TabPage to true or false.

    TabPage1.Enabled = False
    
    tabPage1.Enabled = false;
    
    tabPage1->Enabled = false;
    

To display tabs as buttons

See Also

Tasks

How to: Add a Control to a Tab Page
How to: Disable Tab Pages
How to: Add and Remove Tabs with the Windows Forms TabControl

Reference

TabControl Control Overview (Windows Forms)

Other Resources

TabControl Control (Windows Forms)