This documentation is archived and is not being maintained.

TabControl.Appearance Property

Gets or sets the visual appearance of the control's tabs.

[Visual Basic]
Public Property Appearance As TabAppearance
[C#]
public TabAppearance Appearance {get; set;}
[C++]
public: __property TabAppearance get_Appearance();
public: __property void set_Appearance(TabAppearance);
[JScript]
public function get Appearance() : TabAppearance;
public function set Appearance(TabAppearance);

Property Value

One of the TabAppearance values. The default is Normal.

Exceptions

Exception Type Condition
InvalidEnumArgumentException The property value is not a valid TabAppearance value.

Remarks

When you set the Appearance property to FlatButtons, it only appears as such when the Alignment property is set to Top. Otherwise, the Appearance property appears as if set to the Buttons value.

Note   When you set the Appearance property to Buttons, you must also set the Alignment property to Top so that the buttons display correctly.

Example

[Visual Basic, C#, C++] The following example creates a TabControl with two TabPage objects. This example sets the Appearance property to Buttons, which displays the tabs of the tab pages as buttons.

[Visual Basic, C#, C++] Use the System.Windows.Forms namespace for this example.

[Visual Basic] 
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})
        Controls.Add(tabControl1)
    End Sub

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

[C#] 
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});
        Controls.Add(tabControl1);
    }

    static void Main() 
    {
        Application.Run(new Form1());
    }
}

[C++] 
using namespace System;
using namespace System::Windows::Forms;

public __gc class Form1 : public Form {

public:
    Form1() {
        String* tabText[] = {S"tabPage1", S"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;

        TabPage* tabPageArray[] = {tabPage1, tabPage2};
        tabControl1->Controls->AddRange(tabPageArray);
        Controls->Add(tabControl1);
    }
};

void main() {
    Application::Run(new Form1());
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

TabControl Class | TabControl Members | System.Windows.Forms Namespace | Alignment | TabAppearance

Show: