TabControl.TabPages 属性

获取该选项卡控件中选项卡页的集合。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public ReadOnly Property TabPages As TabPageCollection
用法
Dim instance As TabControl
Dim value As TabPageCollection

value = instance.TabPages
public TabPageCollection TabPages { get; }
public:
property TabPageCollection^ TabPages {
    TabPageCollection^ get ();
}
/** @property */
public TabPageCollection get_TabPages ()
public function get TabPages () : TabPageCollection

属性值

TabControl.TabPageCollection,它包含该 TabControl 中的 TabPage 对象。

备注

此集合中的选项卡页的顺序反映了选项卡在控件中出现的顺序。

示例

下面的代码示例创建一个包含一个 TabPageTabControl。本示例使用 Add 方法将单个选项卡页添加到 tabControl1 选项卡控件中。请注意,TabPages 属性用于获取 tabControl1 控件集合以将 tabPage1 添加到此集合中。

在此示例中使用 System.DrawingSystem.Windows.Forms 命名空间。

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
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());
    }
}
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 );
}
import System.Drawing.*;
import System.Windows.Forms.*;

public class Form1 extends 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.get_TabPages().Add(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().Add(tabControl1);
    } //Form1

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

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

TabControl 类
TabControl 成员
System.Windows.Forms 命名空间
TabControl.TabPageCollection
TabPage