C#添加使用窗体的控件在运行时的标签 [英] C# Adding tabs at runtime using Form's controls
问题描述
我也想过这个想法,你可以有一个窗体上的标签控制,但不是在运行之前定义每个标签控件,继承或者使用另一种形式的控制。
基本上是一个标签控制在一个没有标签上运行之前,在主窗体上的地方。当运行走来我要创建标签,但是这将是每个选项卡上的控件是从单独的已创建的形式。
每个形式是一个单独的标签即已在运行时之前创建的。
这可能吗?是这样,怎么样?
在此先感谢
我使用的是3.5 <编辑
/ p>
首先创建一个用户控制和设计它,你会经常的形式,然后将其添加到您的 TabControl.TabPages
的TabPage页=新的TabPage(标题);
page.Controls.Add(新CustomUserControl()); //用户控件
this.tabControl1.TabPages.Add(页);
I have thought of this idea where you could have a tab control on a form, but instead of defining each tabs controls before runtime, inherit or use another form's controls.
Basically a tab control is in place on the main form that has no tabs on it before runtime. When runtime comes along I want to create tabs, but the controls that would be on each tab would be from seperate already created forms.
Each form would be a seperate tab that had been created prior to runtime.
Is this possible? Is so, how?
Thanks in advance
EDIT I'm using 3.5
first create a User Control and design it as you would a regular form, then add it to your TabControl.TabPages
TabPage page = new TabPage("Title");
page.Controls.Add(new CustomUserControl()); //your user control
this.tabControl1.TabPages.Add(page);
这篇关于C#添加使用窗体的控件在运行时的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!