/// <summary> /// Raises the <see cref="Form.Deactivate"/> event. /// </summary> /// <param name="e">An <see cref="EventArgs"/> that contains the event data.</param> protected override void OnDeactivate(EventArgs e) { base.OnDeactivate(e); CampMdiParent parent = this.MdiParent as CampMdiParent; IEnumerable <ToolStrip> toolstrips = this.GetMergingToolStrips(); if (parent != null && toolstrips != null && toolstrips.Count() > 0) { foreach (var strip in toolstrips) { ToolStripManager.RevertMerge(parent.MainToolStrip, strip); } } }
/// <summary> /// Handles the <see cref="Form.Load"/> event. /// </summary> /// <param name="e">An <see cref="EventArgs"/> that contains the event data.</param> protected override void OnLoad(EventArgs e) { CampMdiParent parent = this.MdiParent as CampMdiParent; if (parent != null && this.StartPosition == FormStartPosition.CenterParent) { // center the form in the MDI area Size clientArea = parent.AdjustedClientSize; if (this.Width <= clientArea.Width && this.Height <= clientArea.Height) { this.Location = new Point((clientArea.Width - this.Width) / 2, (clientArea.Height - this.Height) / 2); } } base.OnLoad(e); }