成都网站建设设计

将想法与焦点和您一起共享

Winfrom在tabcontrol中嵌入form

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));
}

名称栏目:Winfrom在tabcontrol中嵌入form
文章分享:http://chengdu.cdxwcx.cn/article/pcjsjh.html