如何在c#中插入包含按钮的userControl,标签为TabControl页面? (代码是什么)
注意:
代码:
public Courses()
{
InitializeComponent();
ucAction1.tpDelete // (userControl name,firts tabControl tabPage), i dont know how to move on from here?
}
答案 0 :(得分:1)
如果您只是想手动将usercontrol添加到标签页:
tabPage1.Controls.Add(ucAction1);
<强>更新强>
我“想”我理解你的问题。在usercontrol中的tabcontrol中,将每个TabPage的Modifiers属性更改为Public。然后你可以访问它:
ucAction1.tabPage1.Controls.Add(new TextBox());
答案 1 :(得分:1)
Public Sub addTabPage(ByVal Title As String)
Dim TPage As New TabPage(Title)
Dim UCInstance As New UControl()
TPage.Controls.Add(UCInstance)
TabControl1.TabPages.Add(TPage)
UCInstance.Dock = DockStyle.Fill
End Sub
答案 2 :(得分:0)
像这样在UserControl1
上致电tapPage1
UserControl1 myUserControl = new UserControl1();
myUserControl.Dock = DockStyle.Fill;
tabPage1.Controls.Add(myUserControl);