Freigeben über


TabControl.Appearance-Eigenschaft

Ruft die visuelle Darstellung der Registerkarten des Steuerelements ab oder legt diese fest.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
<LocalizableAttribute(True)> _
Public Property Appearance As TabAppearance
'Usage
Dim instance As TabControl
Dim value As TabAppearance

value = instance.Appearance

instance.Appearance = value
[LocalizableAttribute(true)] 
public TabAppearance Appearance { get; set; }
[LocalizableAttribute(true)] 
public:
property TabAppearance Appearance {
    TabAppearance get ();
    void set (TabAppearance value);
}
/** @property */
public TabAppearance get_Appearance ()

/** @property */
public void set_Appearance (TabAppearance value)
public function get Appearance () : TabAppearance

public function set Appearance (value : TabAppearance)

Eigenschaftenwert

Einer der TabAppearance-Werte. Der Standardwert ist Normal.

Ausnahmen

Ausnahmetyp Bedingung

InvalidEnumArgumentException

Der Eigenschaftenwert ist kein gültiger TabAppearance-Wert.

Hinweise

Wenn Sie die Appearance-Eigenschaft auf FlatButtons festlegen, wird diese nur als solche angezeigt, wenn die Alignment-Eigenschaft auf Top festgelegt ist. Andernfalls wird die Appearance-Eigenschaft angezeigt, als wäre sie auf den Buttons-Wert festgelegt.

Hinweis

Wenn Sie die Appearance-Eigenschaft auf Buttons festlegen, müssen Sie auch die Alignment-Eigenschaft auf Top festlegen, damit die Schaltflächen ordnungsgemäß angezeigt werden.

Beispiel

Im folgenden Codebeispiel wird ein TabControl mit zwei TabPage-Objekten erstellt. Im Beispiel wird die Appearance-Eigenschaft auf Buttons festgelegt, sodass die Register der Registerkarten als Schaltflächen angezeigt werden.

Verwenden Sie für dieses Beispiel den System.Windows.Forms-Namespace.

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
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());
    }
}
using namespace System;
using namespace System::Windows::Forms;
public ref class Form1: public Form
{
public:
   Form1()
   {
      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 );
}
import System.Windows.Forms.*;

public class Form1 extends 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.set_Appearance(TabAppearance.Buttons);
        tabControl1.get_Controls().AddRange(new TabPage[] {tabPage1, tabPage2});
        get_Controls().Add(tabControl1);
    } //Form1

    public static void main(String[] args)
    {
        Application.Run(new Form1());
    } //main
} //Form1

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

TabControl-Klasse
TabControl-Member
System.Windows.Forms-Namespace
TabControl.Alignment-Eigenschaft
TabAppearance-Enumeration