/// <summary> /// Removes an owned form from this form. /// </summary> /// <param name="ownedForm">A <see cref="Form"/> representing the form to remove from the list of owned forms for this form.</param> /// <remarks> /// https://msdn.microsoft.com/en-us/library/system.windows.forms.form.removeownedform(v=vs.110).aspx /// </remarks> public void RemoveOwnedForm(Form ownedForm) { Form[] tForms = new Form[OwnedForms.Length - 1]; int tIndex = 0; foreach (Form f in OwnedForms) { if (!f.Equals(ownedForm)) { tForms[tIndex] = f; tIndex++; } } OwnedForms = tForms; }
/// <summary> /// Adds an owned form to this form. /// </summary> /// <param name="ownedForm">The <see cref="Form"/> that this form will own.</param> /// <remarks> /// https://msdn.microsoft.com/en-us/library/system.windows.forms.form.addownedform(v=vs.110).aspx /// </remarks> public void AddOwnedForm(Form ownedForm) { Form[] tForms = new Form[OwnedForms.Length + 1]; for (int i = 0; i < OwnedForms.Length; i++) { tForms[i] = OwnedForms[i]; } tForms[tForms.Length - 1] = ownedForm; OwnedForms = tForms; }