添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
public ref class TabPage : System::Windows::Forms::Panel
public class TabPage : System.Windows.Forms.Panel
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
public class TabPage : System.Windows.Forms.Panel
type TabPage = class
    inherit Panel
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type TabPage = class
    inherit Panel
Public Class TabPage
Inherits Panel
TabPage 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 ); 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()); 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

TabPage 控件表示控件中的 TabControl 选项卡式页面。 集合中 TabControl.TabPages 选项卡页的顺序反映了控件中 TabControl 选项卡的顺序。 若要更改控件中选项卡的顺序,必须通过删除选项卡并将其插入新索引来更改其在集合中的位置。

TabPage 控件受其容器约束,因此从 Control 基类继承的某些属性将不起作用,包括 Top 、、 Height Left Width Show Hide

中的 TabControl 选项卡是 的一部分, TabControl 但不是各个 TabPage 控件的一部分。 类的成员 TabPage (如 ForeColor 属性)仅影响选项卡页的客户端矩形,而不会影响选项卡。 此外, Hide TabPage 方法不会隐藏选项卡。若要隐藏选项卡,必须从 TabControl.TabPages 集合中删除 TabPage 控件。

在 .NET Framework 2.0 中,选项卡被视为选项卡页的一部分,用于确定 Enter 何时发生 和 Leave 事件 TabPage 。 在早期版本的.NET Framework中 Enter ,当焦点进入或离开选项卡时,不会发生 和 Leave 事件 TabPage ,而仅在焦点进入或离开选项卡页的客户端矩形时发生。

有关此控件如何响应 Focus Select 方法的详细信息,请参阅以下 Control 成员: CanFocus 、、 CanSelect Focused ContainsFocus Focus 、。 Select

在显示选项卡页之前,不会创建 包含在 中的 TabPage 控件,并且这些控件中的任何数据绑定在选项卡页显示之前不会激活。

在 .NET Framework 2.0 中, UseVisualStyleBackColor 属性允许你指示选项卡页的背景是否应使用当前视觉样式呈现。 仅当 和 Application.RenderWithVisualStyles 属性值均为 true Appearance TabControl 级的 属性为 Normal UseVisualStyleBackColor ,才会发生这种情况。 否则,将正常绘制背景。