private void OperForm(string fileName) { try { if (fileName == null || !System.IO.File.Exists(fileName)) { return; } _formCount++; //System.IO.File.Copy(fileName, "temp.xml"); DesignerControler hc = _hostSurfaceManager.GetNewHost(fileName); //DesignerControler hc = _hostSurfaceManager.GetNewHost("temp.xml"); this.Toolbox.DesignerHost = hc.DesignerHost; TabPage tabpage = new TabPage("Form" + _formCount.ToString() + " - " + Strings.Design); hc.Parent = tabpage; hc.Dock = DockStyle.Fill; this.tabControl1.TabPages.Add(tabpage); this.tabControl1.SelectedIndex = this.tabControl1.TabPages.Count - 1; this.OutputWindow.RichTextBox.Text += "Opened new host.\n"; } catch { MessageBox.Show("Error in creating new host", "Shell Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void NewForm() { try { _formCount++; DesignerControler hc = _hostSurfaceManager.GetNewHost(typeof(Form));//, CurrentMenuSelectionLoaderType); AddTabForNewHost("Form" + _formCount.ToString() + " - " + Strings.Design, hc); tabControl1.TabPages[tabControl1.TabPages.Count - 1].BackColor = Color.White; } catch { MessageBox.Show("Error in creating new host", "Shell Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void AddTabForNewHost(string tabText, DesignerControler hc) { this.Toolbox.DesignerHost = hc.DesignerHost; TabPage tabpage = new TabPage(tabText); //tabpage.Tag = CurrentMenuSelectionLoaderType; hc.Parent = tabpage; hc.Dock = DockStyle.Fill; this.tabControl1.TabPages.Add(tabpage); this.tabControl1.SelectedIndex = this.tabControl1.TabPages.Count - 1; _hostSurfaceManager.ActiveDesignSurface = hc.HostSurface; //if (CurrentActiveDocumentLoaderType == LoaderType.CodeDomDesignerLoader) // this.eMenuItem.Enabled = true; //else // this.eMenuItem.Enabled = false; this.solutionExplorer1.AddFileNode(tabText); }