TabControl.Appearance Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient ou définit l’apparence visuelle des onglets du contrôle.
public:
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
Valeur de propriété
Une des TabAppearance valeurs. La valeur par défaut est Normal.
Exceptions
La valeur de propriété n’est pas une valeur valide TabAppearance .
Exemples
L’exemple de code suivant crée un TabControl objet avec deux TabPage objets. Cet exemple montre comment définir la Appearance propriété Buttonssur , qui affiche les onglets des pages d’onglets sous forme de boutons.
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 );
}
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());
}
}
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
Remarques
Lorsque vous définissez la Appearance propriété FlatButtonssur , elle apparaît uniquement lorsque la Alignment propriété est définie Topsur . Sinon, la Appearance propriété apparaît comme si elle était définie sur la Buttons valeur.
Note
Lorsque vous définissez la Appearance propriété Buttonssur , vous devez également définir la Alignment propriété pour Top que le contenu de la page tabulation s’affiche correctement.