Share via


TabControl.TabPageCollection.Add Méthode

Définition

Ajoute une page d'onglets à la collection.

Surcharges

Add(String)

Crée une page d'onglets avec le texte spécifié et l'ajoute à la collection.

Add(TabPage)

Ajoute un TabPage à la collection.

Add(String, String)

Crée une page d'onglets avec le texte et la clé spécifiés et l'ajoute à la collection.

Add(String, String, Int32)

Crée une page d'onglets avec la clé, le texte et l'image spécifiés et l'ajoute à la collection.

Add(String, String, String)

Crée une page d'onglets avec la clé, le texte et l'image spécifiés et l'ajoute à la collection.

Add(String)

Crée une page d'onglets avec le texte spécifié et l'ajoute à la collection.

public:
 void Add(System::String ^ text);
public void Add (string text);
public void Add (string? text);
member this.Add : string -> unit
Public Sub Add (text As String)

Paramètres

text
String

Texte à afficher sur la page d'onglets.

Remarques

La nouvelle création TabPage est ajoutée à la fin de la collection.

S’applique à

Add(TabPage)

Ajoute un TabPage à la collection.

public:
 void Add(System::Windows::Forms::TabPage ^ value);
public void Add (System.Windows.Forms.TabPage value);
member this.Add : System.Windows.Forms.TabPage -> unit
Public Sub Add (value As TabPage)

Paramètres

value
TabPage

TabPage à ajouter.

Exceptions

Le value spécifié a la valeur null.

Exemples

L’exemple de code suivant crée un TabControl avec un TabPage. Cet exemple utilise la Add méthode pour ajouter une page d’onglet unique au tabControl1 contrôle tabulation. Notez que la TabPages propriété est utilisée pour obtenir la tabControl1 collection de contrôles à ajouter tabPage1 à cette collection.

using namespace System::Drawing;
using namespace System::Windows::Forms;
public ref class Form1: public Form
{
private:
   TabControl^ tabControl1;
   TabPage^ tabPage1;

public:
   Form1()
   {
      this->tabControl1 = gcnew TabControl;
      this->tabPage1 = gcnew TabPage;
      
      // Gets the controls collection for tabControl1.
      // Adds the tabPage1 to this collection.
      this->tabControl1->TabPages->Add( tabPage1 );
      this->tabControl1->Location = Point(25,25);
      this->tabControl1->Size = System::Drawing::Size( 250, 250 );
      this->ClientSize = System::Drawing::Size( 300, 300 );
      this->Controls->Add( tabControl1 );
   }

};

int main()
{
   Application::Run( gcnew Form1 );
}
using System.Drawing;
using System.Windows.Forms;

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

    public Form1()
    {
        this.tabControl1 = new TabControl();
        this.tabPage1 = new TabPage();

        // Gets the controls collection for tabControl1.
        // Adds the tabPage1 to this collection.
        this.tabControl1.TabPages.Add(tabPage1);

        this.tabControl1.Location = new Point(25, 25);
        this.tabControl1.Size = new Size(250, 250);

        this.ClientSize = new Size(300, 300);
        this.Controls.Add(tabControl1);
    }

    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

    Public Sub New()
        Me.tabControl1 = New TabControl()
        Me.tabPage1 = New TabPage()

        ' Gets the controls collection for tabControl1.
        ' Adds the tabPage1 to this collection.
        Me.tabControl1.TabPages.Add(tabPage1)

        Me.tabControl1.Location = New Point(25, 25)
        Me.tabControl1.Size = New Size(250, 250)

        Me.ClientSize = New Size(300, 300)
        Me.Controls.Add(tabControl1)
    End Sub

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

Voir aussi

S’applique à

Add(String, String)

Crée une page d'onglets avec le texte et la clé spécifiés et l'ajoute à la collection.

public:
 void Add(System::String ^ key, System::String ^ text);
public void Add (string key, string text);
public void Add (string? key, string? text);
member this.Add : string * string -> unit
Public Sub Add (key As String, text As String)

Paramètres

key
String

Nom de la page d'onglets.

text
String

Texte à afficher sur la page d'onglets.

Remarques

La Name propriété correspond à la clé d’un TabPage dans le TabControl.TabPageCollection.

La nouvelle création TabPage est ajoutée à la fin de la collection.

S’applique à

Add(String, String, Int32)

Crée une page d'onglets avec la clé, le texte et l'image spécifiés et l'ajoute à la collection.

public:
 void Add(System::String ^ key, System::String ^ text, int imageIndex);
public void Add (string key, string text, int imageIndex);
public void Add (string? key, string? text, int imageIndex);
member this.Add : string * string * int -> unit
Public Sub Add (key As String, text As String, imageIndex As Integer)

Paramètres

key
String

Nom de la page d'onglets.

text
String

Texte à afficher sur la page d'onglets.

imageIndex
Int32

Index de l'image à afficher sur la page d'onglets.

Remarques

La Name propriété correspond à la clé d’un TabPage dans le TabControl.TabPageCollection.

Le imageIndex paramètre fait référence à une image dans la ImageList propriété du TabControl.

La nouvelle création TabPage est ajoutée à la fin de la collection.

S’applique à

Add(String, String, String)

Crée une page d'onglets avec la clé, le texte et l'image spécifiés et l'ajoute à la collection.

public:
 void Add(System::String ^ key, System::String ^ text, System::String ^ imageKey);
public void Add (string key, string text, string imageKey);
public void Add (string? key, string? text, string imageKey);
member this.Add : string * string * string -> unit
Public Sub Add (key As String, text As String, imageKey As String)

Paramètres

key
String

Nom de la page d'onglets.

text
String

Texte à afficher sur la page d'onglets.

imageKey
String

Clé de l'image à afficher sur la page d'onglets.

Remarques

La Name propriété correspond à la clé d’un TabPage dans le TabControl.TabPageCollection.

Le imageKey paramètre fait référence à une image dans la ImageList propriété du TabControl.

La nouvelle création TabPage est ajoutée à la fin de la collection.

S’applique à