日期:2014-05-18  浏览次数:20732 次

关于TabControl的问题
各位大虾:
              我想实现如下功能:
              在form中添加一个TabControl,设置若干个TabPage。
              我想将部分的TabPage设置成不可见,然后在程序中控制其是否可见。请问应该如何设置,谢谢!

------解决方案--------------------
visible = false
------解决方案--------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication8
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private TabPage ttp;

private void button1_Click(object sender, EventArgs e)
{
this.ttp = this.tabPage2;
this.tabControl1.TabPages.Remove(this.tabPage2);

}

private void button2_Click(object sender, EventArgs e)
{
this.tabControl1.TabPages.Add(this.ttp);
}
}
}

把tabpage保存在一个临时对象里面.需要显示的时候再添加.
或者直接使用第三方控件.
------解决方案--------------------
楼上的思路我觉得可以