40 references to Contains
System.Windows.Forms (13)
System\Windows\Forms\ActiveX\Control.ActiveXImpl.cs (1)
1870
if (_control == target || _control.
Contains
(target))
System\Windows\Forms\Control.cs (2)
5473
if (!
Contains
(ctl))
9852
if (!
Contains
(ctl) || (!nested && ctl._parent != this))
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (1)
1058
if (dataGridView.GetContainerControl() is ContainerControl cc && (dataGridView.EditingControl == cc.ActiveControl || dataGridView.EditingControl.
Contains
(cc.ActiveControl)))
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.MouseHook.cs (1)
166
&& !_control.
Contains
(targetControl))
System\Windows\Forms\Controls\WebBrowser\WebBrowserContainer.cs (1)
377
if (containingControl is not null && containingControl.
Contains
(site))
System\Windows\Forms\Layout\Containers\ContainerControl.cs (5)
470
if (control == _activeControl || control.
Contains
(_activeControl))
519
&& (cc._unvalidatedControl == control || control.
Contains
(cc._unvalidatedControl)))
525
if (control == _unvalidatedControl || control.
Contains
(_unvalidatedControl))
630
&& !
Contains
(_activeControl), "ActiveControl is not a child of this ContainerControl");
1463
if (value is not null && !
Contains
(value))
System\Windows\Forms\Layout\Containers\SplitContainer.cs (2)
1828
if (!
Contains
(ctl) ||
1931
if (!
Contains
(ctl) ||
System.Windows.Forms.Design (13)
System\Windows\Forms\Design\CommandSet.cs (5)
1527
else if (selectedControl.Parent != commonParent && !commonParent.
Contains
(selectedControl))
1530
commonParent = selectedControl == commonParent || selectedControl.
Contains
(commonParent) ? selectedControl.Parent : null;
1673
if (selectedControl.Parent != controlCommonParent && !controlCommonParent.
Contains
(selectedControl))
1676
if (selectedControl == controlCommonParent || selectedControl.
Contains
(controlCommonParent))
1684
while (parent is not null && !parent.
Contains
(selectedControl))
System\Windows\Forms\Design\ControlCommandSet.cs (3)
1454
if (targetSelection is null && ctl is not null && (baseCtl.
Contains
(ctl) || baseCtl == currentSelection))
1748
else if (cX.Parent is null || cX.
Contains
(cY))
1752
else if (cY.Parent is null || cY.
Contains
(cX))
System\Windows\Forms\Design\ControlDesigner.cs (1)
408
=> parentDesigner is ParentControlDesigner p && !Control.
Contains
(p.Control);
System\Windows\Forms\Design\ParentControlDesigner.cs (2)
455
if (host is not null && newChild is not null && !Control.
Contains
(newChild)
783
return !control.
Contains
(Control);
System\Windows\Forms\Design\TabControlDesigner.cs (1)
112
public override bool CanParent(Control control) => (control is TabPage && !Control.
Contains
(control));
System\Windows\Forms\Design\ToolStripKeyboardHandlingService.cs (1)
1981
if (targetSelection is null && ctl is not null && (baseCtl.
Contains
(ctl) || baseCtl == currentSelection))
System.Windows.Forms.Tests (14)
System\Windows\Forms\ControlTests.Methods.cs (14)
803
Assert.True(parent.
Contains
(control));
804
Assert.True(parent.
Contains
(child1));
805
Assert.True(parent.
Contains
(child2));
806
Assert.True(parent.
Contains
(grandchild1));
807
Assert.False(parent.
Contains
(parent));
809
Assert.True(control.
Contains
(child1));
810
Assert.True(control.
Contains
(child2));
811
Assert.True(control.
Contains
(grandchild1));
812
Assert.False(control.
Contains
(control));
813
Assert.False(control.
Contains
(parent));
815
Assert.False(control.
Contains
(emptyControl));
816
Assert.False(control.
Contains
(otherParent));
817
Assert.False(control.
Contains
(otherControl));
818
Assert.False(control.
Contains
(null));