TabControl.Appearance 属性


获取或设置控件选项卡的可视外观。Gets or sets the visual appearance of the control's tabs.

 property System::Windows::Forms::TabAppearance Appearance { System::Windows::Forms::TabAppearance get(); void set(System::Windows::Forms::TabAppearance value); };
public System.Windows.Forms.TabAppearance Appearance { get; set; }
member this.Appearance : System.Windows.Forms.TabAppearance with get, set
Public Property Appearance As TabAppearance


TabAppearance 值之一。One of the TabAppearance values. 默认值为 NormalThe default is Normal.


属性值不是有效的 TabAppearance 值。The property value is not a valid TabAppearance value.


下面的代码示例创建一个TabControl具有两TabPage个对象的。The following code example creates a TabControl with two TabPage objects. 此示例将Appearance属性设置为Buttons,该属性将选项卡页的选项卡显示为按钮。This example sets the Appearance property to Buttons, which displays the tabs of the tab pages as buttons.

using namespace System;
using namespace System::Windows::Forms;
public ref class Form1: public Form
      array<String^>^tabText = {"tabPage1","tabPage2"};
      TabControl^ tabControl1 = gcnew TabControl;
      TabPage^ tabPage1 = gcnew TabPage( tabText[ 0 ] );
      TabPage^ tabPage2 = gcnew TabPage( tabText[ 1 ] );
      // Sets the tabs to appear as buttons.
      tabControl1->Appearance = TabAppearance::Buttons;
      array<TabPage^>^tabPageArray = {tabPage1,tabPage2};
      tabControl1->Controls->AddRange( tabPageArray );
      Controls->Add( tabControl1 );


int main()
   Application::Run( gcnew Form1 );

using System.Windows.Forms;

public class Form1 : Form
    public Form1()
        string[] tabText = {"tabPage1", "tabPage2"};
        TabControl tabControl1 = new TabControl();
        TabPage tabPage1 = new TabPage(tabText[0]);
        TabPage tabPage2 = new TabPage(tabText[1]);

        // Sets the tabs to appear as buttons.
        tabControl1.Appearance = TabAppearance.Buttons;

        tabControl1.Controls.AddRange(new TabPage[] {tabPage1, tabPage2});

    static void Main() 
        Application.Run(new Form1());
Imports System.Windows.Forms

Public Class Form1
    Inherits Form

    Public Sub New()
        Dim tabText As String() = {"tabPage1", "tabPage2"}
        Dim tabControl1 As New TabControl()
        Dim tabPage1 As New TabPage(tabText(0))
        Dim tabPage2 As New TabPage(tabText(1))

        ' Sets the tabs to appear as buttons.
        tabControl1.Appearance = TabAppearance.Buttons

        tabControl1.Controls.AddRange(New TabPage() {tabPage1, tabPage2})
    End Sub

    Shared Sub Main()
        Application.Run(New Form1())
    End Sub
End Class


如果将Appearance属性设置为FlatButtons,则它仅在Alignment属性设置为Top时才会显示。When you set the Appearance property to FlatButtons, it only appears as such when the Alignment property is set to Top. 否则, Appearance属性将显示为,前提是设置Buttons为值。Otherwise, the Appearance property appears as if set to the Buttons value.


Appearance属性设置为Buttons时,还必须将Alignment属性设置为Top ,以便选项卡页的内容正确显示。When you set the Appearance property to Buttons, you must also set the Alignment property to Top so that the tab page contents display correctly.