在选项卡上添加子选项卡? [英] Adding a sub tab to a tab?

查看:139
本文介绍了在选项卡上添加子选项卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以向标签添加子标签?如果可以,有人可以告诉我如何?

举个例子.我有两个标签,例如反馈和评论.在反馈"选项卡下,我需要再创建两个选项卡,例如规则"和连接".非常感谢.

I am wonderinf if it is possible to add a sub tab to a tab? If yes can someone tell me how?

As an example. I have two tabs such as feedbacks and reviews. Under the feedbacks tab I need to create two more tabs like Rules and Conenctions. Thanks a lot.

推荐答案

您可以在一个选项卡页面中放置一个子选项卡控件.这基本上相当于拥有子标签.


--------

这就是我很快使用设计器尝试的方法.添加了一个带有2个选项卡的选项卡控件,在第一个选项卡中,我再次添加了一个带有2个选项卡的内部选项卡控件.内部标签固定在整个页面上.这是VS 2010自动生成的代码:

You could put a child tab-control inside one of the tab-pages. That''d be basically equivalent to having sub-tabs.


--------

Here''s what I quickly tried out using the designer. Added a tab-control with 2 tabs, and in the first tab, I added an inner tab control again with 2 tabs. The inner tab is docked to fill the entire page. Here''s the auto generated code from VS 2010:

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
    this.outerTabControl = new System.Windows.Forms.TabControl();
    this.tabPageFeedback = new System.Windows.Forms.TabPage();
    this.tabPageReviews = new System.Windows.Forms.TabPage();
    this.innerTabControl = new System.Windows.Forms.TabControl();
    this.tabPageRules = new System.Windows.Forms.TabPage();
    this.tabPageConnections = new System.Windows.Forms.TabPage();
    this.outerTabControl.SuspendLayout();
    this.tabPageFeedback.SuspendLayout();
    this.innerTabControl.SuspendLayout();
    this.SuspendLayout();
    //
    // outerTabControl
    //
    this.outerTabControl.Controls.Add(this.tabPageFeedback);
    this.outerTabControl.Controls.Add(this.tabPageReviews);
    this.outerTabControl.Location = new System.Drawing.Point(73, 54);
    this.outerTabControl.Name = "outerTabControl";
    this.outerTabControl.SelectedIndex = 0;
    this.outerTabControl.Size = new System.Drawing.Size(317, 266);
    this.outerTabControl.TabIndex = 0;
    //
    // tabPageFeedback
    //
    this.tabPageFeedback.Controls.Add(this.innerTabControl);
    this.tabPageFeedback.Location = new System.Drawing.Point(4, 22);
    this.tabPageFeedback.Name = "tabPageFeedback";
    this.tabPageFeedback.Padding = new System.Windows.Forms.Padding(3);
    this.tabPageFeedback.Size = new System.Drawing.Size(309, 240);
    this.tabPageFeedback.TabIndex = 0;
    this.tabPageFeedback.Text = "Feedback";
    this.tabPageFeedback.UseVisualStyleBackColor = true;
    //
    // tabPageReviews
    //
    this.tabPageReviews.Location = new System.Drawing.Point(4, 22);
    this.tabPageReviews.Name = "tabPageReviews";
    this.tabPageReviews.Padding = new System.Windows.Forms.Padding(3);
    this.tabPageReviews.Size = new System.Drawing.Size(309, 240);
    this.tabPageReviews.TabIndex = 1;
    this.tabPageReviews.Text = "Reviews";
    this.tabPageReviews.UseVisualStyleBackColor = true;
    //
    // innerTabControl
    //
    this.innerTabControl.Controls.Add(this.tabPageRules);
    this.innerTabControl.Controls.Add(this.tabPageConnections);
    this.innerTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
    this.innerTabControl.Location = new System.Drawing.Point(3, 3);
    this.innerTabControl.Name = "innerTabControl";
    this.innerTabControl.SelectedIndex = 0;
    this.innerTabControl.Size = new System.Drawing.Size(303, 234);
    this.innerTabControl.TabIndex = 0;
    //
    // tabPageRules
    //
    this.tabPageRules.Location = new System.Drawing.Point(4, 22);
    this.tabPageRules.Name = "tabPageRules";
    this.tabPageRules.Padding = new System.Windows.Forms.Padding(3);
    this.tabPageRules.Size = new System.Drawing.Size(295, 208);
    this.tabPageRules.TabIndex = 0;
    this.tabPageRules.Text = "Rules";
    this.tabPageRules.UseVisualStyleBackColor = true;
    //
    // tabPageConnections
    //
    this.tabPageConnections.Location = new System.Drawing.Point(4, 22);
    this.tabPageConnections.Name = "tabPageConnections";
    this.tabPageConnections.Padding = new System.Windows.Forms.Padding(3);
    this.tabPageConnections.Size = new System.Drawing.Size(295, 208);
    this.tabPageConnections.TabIndex = 1;
    this.tabPageConnections.Text = "Connections";
    this.tabPageConnections.UseVisualStyleBackColor = true;
    //
    // Form1
    //
    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    this.ClientSize = new System.Drawing.Size(433, 383);
    this.Controls.Add(this.outerTabControl);
    this.Name = "Form1";
    this.Text = "Form1";
    this.outerTabControl.ResumeLayout(false);
    this.tabPageFeedback.ResumeLayout(false);
    this.innerTabControl.ResumeLayout(false);
    this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.TabControl outerTabControl;
private System.Windows.Forms.TabPage tabPageFeedback;
private System.Windows.Forms.TabControl innerTabControl;
private System.Windows.Forms.TabPage tabPageRules;
private System.Windows.Forms.TabPage tabPageConnections;
private System.Windows.Forms.TabPage tabPageReviews;


这篇关于在选项卡上添加子选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆