System.Windows.Forms.Control.Contains C# (CSharp) Method

Contains() public method

public Contains ( Control ctl ) : bool
ctl Control
return bool
		public bool Contains(Control ctl) {
			while (ctl != null) {
				ctl = ctl.parent;
				if (ctl == this) {
					return true;
				}
			}
			return false;
		}

Usage Example

Example #1
0
        internal void ChildControlRemoved(Control control)
        {
            ContainerControl top_container = FindForm();

            if (top_container == null)
            {
                top_container = this;
            }

            // Remove controls -as well as any sub control- that was in the pending validation chain
            ArrayList pending_validation_chain = top_container.pending_validation_chain;

            if (pending_validation_chain != null)
            {
                RemoveChildrenFromValidation(pending_validation_chain, control);

                if (pending_validation_chain.Count == 0)
                {
                    top_container.pending_validation_chain = null;
                }
            }

            if (control == active_control || control.Contains(active_control))
            {
                SelectNextControl(this, true, true, true, true);
                if (control == active_control || control.Contains(active_control))
                {
                    active_control = null;
                }
            }
        }
All Usage Examples Of System.Windows.Forms.Control::Contains
Control