//首先定义tabpage
TabPage OderListPage = new TabPage();
初始化窗口
InventoryList myInventoryList = new InventoryList();
//加载进入tabControl中
if (tabControl1.TabPages["myInventoryList"] == null)
{
InventoryListPage.Text = "" + myInventoryList.Text;
InventoryListPage.Name = "myInventoryList";
myInventoryList.TopLevel = false;
myInventoryList.FormBorderStyle = FormBorderStyle.None;
myInventoryList.Width = this.tabControl1.Width;
myInventoryList.Height = this.tabControl1.Height - this.tabControl1.ItemSize.Height;
InventoryListPage.Controls.Add(myInventoryList);
myInventoryList.Show();
tabControl1.TabPages.Add(InventoryListPage);
}
else
{
if (tabControl1.TabPages.Contains(InventoryListPage))
{
tabControl1.SelectedTab = InventoryListPage;
}
else
{
tabControl1.TabPages.Add(InventoryListPage);
}
}
this.tabControl1.SelectedTab = InventoryListPage;
将窗体作为tabpage的内容,加载进tabcontrol中
最新推荐文章于 2023-09-12 11:19:12 发布