public DesignerControler GetNewHost(Type rootComponentType) { ControlerSurface hostSurface = (ControlerSurface)this.CreateDesignSurface(this.ServiceContainer); IDesignerHost host = (IDesignerHost)hostSurface.GetService(typeof(IDesignerHost)); BasicDesignerViewer basicHostLoader = new BasicDesignerViewer(rootComponentType); hostSurface.BeginLoad(basicHostLoader); hostSurface.Loader = basicHostLoader; return(new DesignerControler(hostSurface)); }
public DesignerControler GetNewHost(string fileName) { if (fileName == null || !File.Exists(fileName)) { MessageBox.Show("FileName is incorrect: " + fileName); } ControlerSurface hostSurface = (ControlerSurface)this.CreateDesignSurface(this.ServiceContainer); IDesignerHost host = (IDesignerHost)hostSurface.GetService(typeof(IDesignerHost)); BasicDesignerViewer basicHostLoader = new BasicDesignerViewer(fileName); hostSurface.BeginLoad(basicHostLoader); hostSurface.Loader = basicHostLoader; hostSurface.Initialize(); return(new DesignerControler(hostSurface)); }
private void DesignerShellForm_FormClosing(object sender, FormClosingEventArgs e) { BasicDesignerViewer basicDesignerViewer = CurrentDesignerViewer; if (basicDesignerViewer != null && basicDesignerViewer.WantSave) { switch (XtraMessageBox.Show("设计已修改并且未保存,需要保存吗", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)) { case DialogResult.Yes: basicDesignerViewer.Save(false); break; case DialogResult.Cancel: e.Cancel = true; break; } } }