public CadForm(string[] args) { InitializeComponent(); // makes the cadCanvas and the propertiesExplorer KeyPreview = true; // used to filter the escape key (and maybe some more?) cadFrame = new CadFrame(propertiesExplorer, cadCanvas, this); cadFrame.ProgressAction = (show, percent, title) => { this.ProgressForm.ShowProgressBar(show, percent, title); }; cadCanvas.Frame = cadFrame; propertiesExplorer.Frame = cadFrame; // show this menu in the MainForm MenuWithHandler[] mainMenu = MenuResource.LoadMenuDefinition("SDI Menu", true, cadFrame); #region DebuggerPlayground, you can remove this region // in the following lines a "DebuggerPlayground" object is created via reflection. This class is a playground to write testcode // which is not included in the sources. This is why it is constructed via reflection, there is no need to have this class in the project. Type dbgplygnd = Type.GetType("CADability.Forms.DebuggerPlayground", false); if (dbgplygnd != null) { MethodInfo connect = dbgplygnd.GetMethod("Connect"); if (connect != null) { mainMenu = connect.Invoke(null, new object[] { cadFrame, mainMenu }) as MenuWithHandler[]; } } #endregion DebuggerPlayground Menu = MenuManager.MakeMainMenu(mainMenu); cadFrame.FormMenu = Menu; // open an existing Project or create a new one ToolBars.CreateOrRestoreToolbars(topToolStripContainer, cadFrame); Application.Idle += new EventHandler(OnIdle); // update the toolbars (menus are updated when they popup) }
protected override void OnHandleCreated(EventArgs e) { setupParentForm(); // open an existing Project or create a new one ToolBars.CreateOrRestoreToolbars(toolStripContainer, cadFrame); Application.Idle += new EventHandler(OnIdle); // update the toolbars (menus are updated when they popup) base.OnHandleCreated(e); }