private void InstanceForm() { MeasuresForm = new MeasuresProjectForm() { CurrentBusiness = this.CurrentBusiness, Activitie = this.Activitie, BusContainer = this, TopLevelForm = this.MainForm, FormBorderStyle = FormBorderStyle.None, Dock = DockStyle.Fill, //设置为非顶级控 TopLevel = false, //显示窗体 Visible = true }; FormList["措施项目"] = MeasuresForm; MeasuresForm.LoadControls(); OtherProject = new OtherProjectForm(this.Activitie) { CurrentBusiness = this.CurrentBusiness, Activitie = this.Activitie, BusContainer = this, TopLevelForm = this.MainForm, FormBorderStyle = FormBorderStyle.None, Dock = DockStyle.Fill, //设置为非顶级控 TopLevel = false, //显示窗体 Visible = true }; FormList["其他项目"] = OtherProject; OtherProject.LoadControls(); }
/// <summary> /// 要执行那个窗体 /// </summary> /// <param name="p_key"></param> private void doAction(string p_key) { ABaseForm from = null; this.CurrentBusiness.FastCalculate(); if (FormList.Contains(p_key)) { from = this.FormList[p_key] as ABaseForm; from.MustInit(); //第二次加载的时候每次执行 from.Init(); } else { switch (p_key) { case "分部分项": from = new SubSegmentForm(); SubsegmentForm = from as SubSegmentForm; break; //case "工程信息": // from = new ProInformation(); // break; case "基本信息": from = new CBaseUnitProInfo(); from.CurrentBusiness = this.CurrentBusiness; (from as CBaseUnitProInfo).UnitProject = this.Activitie; break; case "工料机汇总": from = new UnitSummaryForm(this.Activitie, this.CurrentBusiness); break; case "汇总分析": from = new CMetaanalysisForm(); //设置当前的单位工程 this.MetaanalysisForm = from as CMetaanalysisForm; this.MetaanalysisForm.UnitProject = this.Activitie; break; case "其他项目": from = new OtherProjectForm(this.Activitie); break; case "措施项目": from = new MeasuresProjectForm(); break; case "工程历史": from = new CHistoryForm(); break; case "报表": from = new ReportForm(); break; //case "参数设置": // from = new ParameterSettings(); break; case "单位工程自检": from = new ProjectCheck(); break; } if (from == null) { return; } from.CurrentBusiness = this.CurrentBusiness; from.Activitie = this.Activitie; from.BusContainer = this; from.TopLevelForm = this.MainForm; from.FormBorderStyle = FormBorderStyle.None; from.Dock = DockStyle.Fill;//设置样式是否填充整个PANEL //设置为非顶级控件 from.TopLevel = false; //显示窗体 from.Visible = true; this.FormList.Add(p_key, from); } //添加之前保存当时的界面配置 this.WorkPanel.Controls.Clear(); this.WorkPanel.Controls.Add(from); if (Parent_Projects != null) { Parent_Projects.OnModelChange(this, from); } else { this.OnModelChange(this, from); } }