TabControl.Alignment Propiedad

Definición

Obtiene o establece el área del control (por ejemplo, a lo largo de la parte superior) donde se alinean las fichas.Gets or sets the area of the control (for example, along the top) where the tabs are aligned.

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

Valor de propiedad

Uno de los valores de TabAlignment.One of the TabAlignment values. De manera predeterminada, es Top.The default is Top.

Excepciones

El valor de propiedad no es un valor válido de TabAlignment.The property value is not a valid TabAlignment value.

Ejemplos

En el ejemplo de código siguiente TabControl se crea TabPage un objeto con tres objetos.The following code example creates a TabControl with three TabPage objects. La Alignment propiedad se establece en Left, que coloca las pestañas tabControl1 de en el lado izquierdo.The Alignment property is set to Left, which positions the tabs of tabControl1 on the left side.

using namespace System::Drawing;
using namespace System::Windows::Forms;
public ref class Form1: public Form
{
private:
   TabControl^ tabControl1;
   TabPage^ tabPage1;
   TabPage^ tabPage2;
   TabPage^ tabPage3;
   void MyTabs()
   {
      this->tabControl1 = gcnew TabControl;
      this->tabPage1 = gcnew TabPage;
      this->tabPage2 = gcnew TabPage;
      this->tabPage3 = gcnew TabPage;
      
      // Positions tabs on the left side of tabControl1.
      this->tabControl1->Alignment = System::Windows::Forms::TabAlignment::Left;
      array<Control^>^tabControls = {this->tabPage1,this->tabPage2,this->tabPage3};
      this->tabControl1->Controls->AddRange( tabControls );
      this->tabControl1->Location = Point(16,24);
      this->tabControl1->SelectedIndex = 0;
      this->tabControl1->Size = System::Drawing::Size( 248, 232 );
      this->tabControl1->TabIndex = 0;
      this->tabPage1->TabIndex = 0;
      this->tabPage2->TabIndex = 1;
      this->tabPage3->TabIndex = 2;
      this->Size = System::Drawing::Size( 300, 300 );
      array<Control^>^formControls = {this->tabControl1};
      this->Controls->AddRange( formControls );
   }


public:
   Form1()
   {
      MyTabs();
   }

};

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

using System.Drawing;
using System.Windows.Forms;

public class Form1 : Form
{
    private TabControl tabControl1;
    private TabPage tabPage1;
    private TabPage tabPage2;
    private TabPage tabPage3;

    private void MyTabs()
    {
        this.tabControl1 = new TabControl();
        this.tabPage1 = new TabPage();
        this.tabPage2 = new TabPage();
        this.tabPage3 = new TabPage();

        // Positions tabs on the left side of tabControl1.
        this.tabControl1.Alignment = System.Windows.Forms.TabAlignment.Left;

        this.tabControl1.Controls.AddRange(new Control[] {
            this.tabPage1,
            this.tabPage2,
            this.tabPage3});
        this.tabControl1.Location = new Point(16, 24);
        this.tabControl1.SelectedIndex = 0;
        this.tabControl1.Size = new Size(248, 232);
        this.tabControl1.TabIndex = 0;

        this.tabPage1.TabIndex = 0;
        this.tabPage2.TabIndex = 1;
        this.tabPage3.TabIndex = 2;

        this.Size = new Size(300,300);
        this.Controls.AddRange(new Control[] {
            this.tabControl1});
    }

    public Form1()
    {
        MyTabs();
    }

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

Public Class Form1
    Inherits Form
    Private tabControl1 As TabControl
    Private tabPage1 As TabPage
    Private tabPage2 As TabPage
    Private tabPage3 As TabPage

    Private Sub MyTabs()
        Me.tabControl1 = New TabControl()
        Me.tabPage1 = New TabPage()
        Me.tabPage2 = New TabPage()
        Me.tabPage3 = New TabPage()

        ' Positions tabs on the left side of tabControl1.
        Me.tabControl1.Alignment = System.Windows.Forms.TabAlignment.Left

        Me.tabControl1.Controls.AddRange(New Control() {Me.tabPage1, Me.tabPage2, Me.tabPage3})
        Me.tabControl1.Location = New Point(16, 24)
        Me.tabControl1.SelectedIndex = 0
        Me.tabControl1.Size = New Size(248, 232)
        Me.tabControl1.TabIndex = 0

        Me.tabPage1.TabIndex = 0
        Me.tabPage2.TabIndex = 1
        Me.tabPage3.TabIndex = 2

        Me.Size = New Size(300, 300)
        Me.Controls.AddRange(New Control() {Me.tabControl1})
    End Sub

    Public Sub New()
        MyTabs()
    End Sub

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

Comentarios

Cuando la Alignment propiedad se establece en Left o Right, la Multiline propiedad se establece automáticamente en true.When the Alignment property is set to Left or Right, the Multiline property is automatically set to true.

Cuando se establece la Appearance propiedad en FlatButtons, solo aparece como tal cuando la Alignment propiedad está establecida en Top.When you set the Appearance property to FlatButtons, it only appears as such when the Alignment property is set to Top. De lo contrario Appearance , la propiedad se muestra como si Buttons se hubiera establecido en el valor.Otherwise, the Appearance property displays as if set to the Buttons value.

Al establecer la Appearance propiedad en Buttons, también debe establecer la Alignment propiedad en para Top que los botones se muestren correctamente.When you set the Appearance property to Buttons, you must also set the Alignment property to Top so that the buttons display correctly.

Nota

Al establecer la Appearance propiedad en Buttons, también debe establecer la Alignment propiedad en para Top que el contenido de la página de ficha se muestre correctamente.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. Además, cuando los estilos visuales están habilitados y Alignment la propiedad se establece en un valor distinto Topde, es posible que el contenido de la pestaña no se represente correctamente.Additionally, when visual styles are enabled, and the Alignment property is set to a value other than Top, the tab contents may not render correctly.

Se aplica a

Consulte también: