Representa una sola página de fichas en un objeto
TabControl.
Espacio de nombres: System.Windows.Forms
Ensamblado: System.Windows.Forms (en system.windows.forms.dll)
Visual Basic (Declaración)
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class TabPage
Inherits Panel
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
[ComVisibleAttribute(true)]
public class TabPage : Panel
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)]
[ComVisibleAttribute(true)]
public ref class TabPage : public Panel
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */
/** @attribute ComVisibleAttribute(true) */
public class TabPage extends Panel
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)
ComVisibleAttribute(true)
public class TabPage extends Panel
Los controles TabPage representan las páginas con fichas en un control TabControl. El orden de páginas de fichas en la colección TabControl.TabPages refleja el orden de las fichas en el control TabControl. Para cambiar el orden de las fichas en el control, debe cambiar sus posiciones en la colección quitándolos e insertándolos en los nuevos índices.
El contenedor restringe los controles TabPage, por lo que algunas de las propiedades heredadas de la clase base Control no tendrán ningún efecto, incluyendo Top, Height, Left, Width, Show y Hide.
Las fichas de un TabControl forman parte de TabControl, pero no forman parte de los controles TabPage individuales. Los miembros de la clase TabPage, como la propiedad ForeColor, sólo afectan al rectángulo cliente de la página de fichas, pero no a las fichas. Además, el método Hide de TabPage no ocultará la ficha. Para ocultar la ficha, debe quitar el control TabPage de la colección TabControl.TabPages.
Nota: |
|---|
| En Microsoft .NET Framework versión 2.0, la ficha se considera parte de la página de fichas para determinar cuándo se producen los eventos Enter y Leave de TabPage. En las versiones anteriores de .NET Framework, los eventos Enter y Leave de TabPage no se producen cuando una ficha tiene el foco o lo pierde; únicamente se producen cuando el rectángulo cliente de la página de fichas tiene el foco o lo pierde. |
Para obtener más información sobre cómo responde este control a los métodos Focus y Select, vea los siguientes miembros Control: CanFocus, CanSelect, Focused, ContainsFocus, Focus, Select.
Nota: |
|---|
| Los controles incluidos en TabPage no se crean hasta que se muestra la página de fichas; tampoco se activan los enlaces de datos de estos controles hasta que dicha página de fichas se muestra. |
En Microsoft .NET Framework versión 2.0, la propiedad UseVisualStyleBackColor le permite indica si el fondo de la página de fichas debe representarse utilizando el estilo visual actual. Esto sólo ocurre cuando los valores de las propiedades UseVisualStyleBackColor y Application.RenderWithVisualStyles son true, y cuando la propiedad Appearance del TabControl primario es Normal. De lo contrario, el fondo se pinta normalmente.
En el ejemplo de código siguiente se crea un control TabControl con un objeto TabPage.
Para este ejemplo se utilizan los espacios de nombres System.Drawing y System.Windows.Forms.
Imports System.Drawing
Imports System.Windows.Forms
Public Class Form1
Inherits Form
Private tabControl1 As TabControl
' Declares tabPage1 as a TabPage type.
Private tabPage1 As System.Windows.Forms.TabPage
Private Sub MyTabs()
Me.tabControl1 = New TabControl()
' Invokes the TabPage() constructor to create the tabPage1.
Me.tabPage1 = New System.Windows.Forms.TabPage()
Me.tabControl1.Controls.AddRange(New Control() {Me.tabPage1})
Me.tabControl1.Location = New Point(25, 25)
Me.tabControl1.Size = New Size(250, 250)
Me.ClientSize = 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
using System.Drawing;
using System.Windows.Forms;
public class Form1 : Form
{
private TabControl tabControl1;
// Declares tabPage1 as a TabPage type.
private System.Windows.Forms.TabPage tabPage1;
private void MyTabs()
{
this.tabControl1 = new TabControl();
// Invokes the TabPage() constructor to create the tabPage1.
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabControl1.Controls.AddRange(new Control[] {
this.tabPage1});
this.tabControl1.Location = new Point(25, 25);
this.tabControl1.Size = new Size(250, 250);
this.ClientSize = new Size(300, 300);
this.Controls.AddRange(new Control[] {
this.tabControl1});
}
public Form1()
{
MyTabs();
}
static void Main()
{
Application.Run(new Form1());
}
}
using namespace System::Drawing;
using namespace System::Windows::Forms;
public ref class Form1: public Form
{
private:
TabControl^ tabControl1;
// Declares tabPage1 as a TabPage type.
System::Windows::Forms::TabPage^ tabPage1;
void MyTabs()
{
this->tabControl1 = gcnew TabControl;
// Invokes the TabPage() constructor to create the tabPage1.
this->tabPage1 = gcnew System::Windows::Forms::TabPage;
array<Control^>^tabControls = {this->tabPage1};
this->tabControl1->Controls->AddRange( tabControls );
this->tabControl1->Location = Point(25,25);
this->tabControl1->Size = System::Drawing::Size( 250, 250 );
this->ClientSize = System::Drawing::Size( 300, 300 );
array<Control^>^formControls = {this->tabControl1};
this->Controls->AddRange( formControls );
}
public:
Form1()
{
MyTabs();
}
};
int main()
{
Application::Run( gcnew Form1 );
}
import System.Drawing.*;
import System.Windows.Forms.*;
public class Form1 extends Form
{
private TabControl tabControl1;
// Declares tabPage1 as a TabPage type.
private System.Windows.Forms.TabPage tabPage1;
private void MyTabs()
{
this.tabControl1 = new TabControl();
// Invokes the TabPage() constructor to create the tabPage1.
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabControl1.get_Controls().AddRange(new Control[] {
this.tabPage1 });
this.tabControl1.set_Location(new Point(25, 25));
this.tabControl1.set_Size(new Size(250, 250));
this.set_ClientSize(new Size(300, 300));
this.get_Controls().AddRange(new Control[] { this.tabControl1 });
} //MyTabs
public Form1()
{
MyTabs();
} //Form1
public static void main(String[] args)
{
Application.Run(new Form1());
} //main
} //Form1
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.ScrollableControl
System.Windows.Forms.Panel
System.Windows.Forms.TabPage
Microsoft.Web.Management.Client.Win32.ManagementTabPage
Seguridad para subprocesos
Los miembros estáticos públicos (Shared en Visual Basic) de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.
Windows 98, Windows 2000 Service Pack 4, Windows CE, Windows Millennium, Windows Mobile para Pocket PC, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter
Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.
.NET Framework
Compatible con: 3.0, 2.0, 1.1, 1.0
.NET Compact Framework
Compatible con: 2.0, 1.0