/// <summary> /// Creates a form if it does not already exist and adds the given control. /// </summary> /// <param name="control"></param> /// <returns></returns> protected RibbonForm GetOrCreateForm(Control control) { RibbonWindowForm form; if (windowDictionary.ContainsKey(control)) { form = (RibbonWindowForm)windowDictionary[control]; } else { form = new RibbonWindowForm(); windowDictionary.Add(control, form); form.Controls.Add(control); CalculateSize(control, form); control.Dock = DockStyle.Fill; control.Disposed += ControlDisposed; WireUpForm(form); } return(form); }
private void WireUpForm(RibbonWindowForm form) { form.WindowFormClosing += WindowFormClosing; form.WindowFormClosed += WindowFormClosed; form.WindowFormActivated += WindowFormActivated; }