/// <summary> /// Overridden. Adds a <see cref="Control"/> to the /// <see cref="ImageTabControl"/>. /// </summary> /// <param name="value"> /// The <see cref="Control"/> to add, which must be a /// <see cref="YaTabPage"/>. /// </param> /// <exception cref="ArgumentNullException"> /// Thrown if <i>value</i> is <b>null</b>. /// </exception> /// <exception cref="ArgumentException"> /// Thrown if <i>value</i> is not a <see cref="YaTabPage"/>. /// </exception> public override void Add(Control value) { if (value == null) { throw new ArgumentNullException("value", "Tried to add a null value to the ImageTabControl.ControlCollection."); } ImageTabPage p = value as ImageTabPage; if (p == null) { throw new ArgumentException("Tried to add a non-YaTabPage control to the ImageTabControl.ControlCollection.", "value"); } TabPages.Add(p); p.SendToBack(); p._index = base.Count; if (p.Text == null || p.Text.Length == 0) { p.Text = "Tab" + p._index; } //p.Dock = DockStyle.Fill; owner.SetTabSize(ref p); base.Add(p); if (owner.Parent != null) { Rectangle bounds = owner.GetTabRect(p); p.SetBounds(bounds.X, bounds.Y, bounds.Width, bounds.Height); owner.InU(); } p.TextChanged += monitor; }
/// <summary> /// Overridden. Inherited from <see cref="Control.ControlCollection.Remove( Control )"/>. /// </summary> /// <param name="value"></param> public override void Remove(Control value) { value.TextChanged -= monitor; ImageTabPage pageToRemove = null; foreach (ImageTabPage page in TabPages) { if (page.Name.Equals(value.Name)) { pageToRemove = page; } } if (pageToRemove != null) { base.Remove(pageToRemove); TabPages.Remove(pageToRemove); } }