參考引用來源
C#利用tabControl控件实现多窗体嵌入及关闭
--
public bool tabControlCheckHave(System.Windows.Forms.TabControl tab, String tabName)
{
for (int i = 0; i < tab.TabCount; i++)
{
if (tab.TabPages[i].Text == tabName)
{
tab.SelectedIndex = i;
return true;
}
}
return false;
}
public void Add_TabPage(string str, Form myForm)
{
if (tabControlCheckHave(this.tabControl1, str)) { return; }
else
{
tabControl1.TabPages.Add(str);
tabControl1.SelectTab(tabControl1.TabPages.Count - 1);
myForm.FormBorderStyle = FormBorderStyle.None;
myForm.TopLevel = false;
myForm.Show();
myForm.Parent = tabControl1.SelectedTab;
tabControl1.SelectedTab.AutoScroll = true;
}
}
private void BindTabPage(LB002 lb)
{
Add_TabPage("基本參數", new frmTypeParameter(lb));
Add_TabPage("機型客艙", new frmAircraftCabin());
Add_TabPage("基本參數", new frmTypeParameter(lb));
Add_TabPage("機型客艙", new frmAircraftCabin(lb));
Add_TabPage("散裝艙", new frmHeavyBulkTankJoint());
Add_TabPage("集裝箱", new frmContainer());
Add_TabPage("機組", new frmStandardUnitConfigurationInformation());
Add_TabPage("機供品", new frmJiGongPinInformation(lb));
Add_TabPage("油量指數範圍", new frmOilIndex(lb));
Add_TabPage("重心包線範圍", new frmCenterOfGravityEnvelope());
Add_TabPage("最佳重心範圍", new frmBestWeight(lb));
Add_TabPage("配平值", new frmBalancingValue());
Add_TabPage("特別項目", new frmStretcherSeatInformation());
Add_TabPage("板箱", new frmBoardBoxes());
Add_TabPage("側平衡&側不平衡", new frmSideOfBalance());
Add_TabPage("艙位信息", new frmShippingSpaceInformation());
Add_TabPage("尾油箱", new frmTailOilTank(lb));
}
--
依照這寫法,小試了一下;感覺還不錯!
沒有留言:
張貼留言