Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# tabControl,在我的应用程序中即时消息时,是否有方法添加新选项卡?_C#_.net_Tabcontrol - Fatal编程技术网

C# tabControl,在我的应用程序中即时消息时,是否有方法添加新选项卡?

C# tabControl,在我的应用程序中即时消息时,是否有方法添加新选项卡?,c#,.net,tabcontrol,C#,.net,Tabcontrol,我是tabControl的新手,我想知道是否有办法从我的应用程序中添加新标签?(从启动时开始,即) 我想我可能会做这样的事 创建一个按钮并向其添加一个函数,如下所示 private void addTabButton_Click(object sender, EventArgs e) { tabControl1.addtab <- or something like that, I dont know the correct function. Not even sure if th

我是tabControl的新手,我想知道是否有办法从我的应用程序中添加新标签?(从启动时开始,即)

我想我可能会做这样的事

创建一个按钮并向其添加一个函数,如下所示

private void addTabButton_Click(object sender, EventArgs e)
{
   tabControl1.addtab <- or something like that, I dont know the correct function. Not even sure if there is any
}
private void addTabButton\单击(对象发送者,事件参数e)
{
tabControl1.addtab
因此,您可以动态创建一个选项卡,并可以根据需要在此处设置tabpage的所有属性。我使用TabCount的命名和文本设置使tabpage至少更加动态和不同

private void addTabButton_Click(object sender, EventArgs e)
{
   Tabpage tp = new TabPage();
   tp.Name = "tp" + this.tabControl1.TabCount;
   tp.Text = "tp" + this.tabControl1.TabCount;
   tp.Controls.Add(new Label()); //Or whatever you want added.
   this.tabControl1.TabPages.Add(tp);
}