Implemented interface member:
2 overrides of Count
System.Windows.Forms.Design (2)
System\Windows\Forms\Design\ControlDesigner.DesignerControlCollection.cs (1)
22public override int Count => _realCollection.Count;
System\Windows\Forms\Design\TableLayoutPanelDesigner.cs (1)
2160public override int Count => _realCollection.Count;
453 references to Count
System.Windows.Forms (330)
System\Windows\Forms\ContextMenuStrip.cs (1)
64for (int i = 0; i < Items.Count; i++)
System\Windows\Forms\Control.ControlCollection.ControlCollectionEnumerator.cs (2)
24_originalCount = controls.Count; 41if (_current < _controls.Count - 1 && _current < _originalCount - 1)
System\Windows\Forms\Control.ControlCollection.cs (11)
79for (int c = 0; c < (Count - 1); c++) 191for (int i = 0; i < controlsToLookIn.Count; i++) 207for (int i = 0; i < controlsToLookIn.Count; i++) 214if (controlsToLookIn[i].Controls.Count > 0) 255for (int i = 0; i < Count; i++) 274return ((index >= 0) && (index < Count)); 346ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(index, Count); 387while (Count != 0) 389RemoveAt(Count - 1); 430if (newIndex >= Count || newIndex == -1) 432newIndex = Count - 1;
System\Windows\Forms\Control.cs (35)
2144public bool HasChildren => ChildControls is not null && ChildControls.Count > 0; 3361for (int i = 0; i < children.Count; i++) 4582Control[] controlSnapshot = new Control[children.Count]; 4740for (int i = 0; i < children.Count; i++) 4775for (int i = 0; i < children.Count; i++) 5367List<ControlTabOrderHolder> holders = new(Controls.Count); 5398for (int c = 0; c < children.Count; c++) 5410for (int c = children.Count - 1; c >= 0; c--) 5480if (ChildControls is { } children && children.Count > 0 && (ctl == this || !IsFocusManagingContainerControl(ctl))) 5505parentChildCount = parentChildren.Count; 5563int siblingCount = siblings.Count; 5635while (children is not null && children.Count > 0 && (ctl == this || !IsFocusManagingContainerControl(ctl))) 6562for (int i = 0; i < children.Count; i++) 6586for (int i = 0; i < children.Count; i++) 6629for (int i = 0; i < children.Count; i++) 6673for (int i = 0; i < children.Count; i++) 6695for (int i = 0; i < children.Count; i++) 6744for (int i = 0; i < children.Count; i++) 6788for (int i = 0; i < children.Count; i++) 6815for (int i = 0; i < children.Count; i++) 6843for (int i = 0; i < children.Count; i++) 7028for (int i = 0; i < children.Count; i++) 7128for (int i = 0; i < children.Count; i++) 7148for (int i = 0; i < children.Count; i++) 7582for (int i = 0; i < children.Count; i++) 7976for (int i = 0; i < children.Count; i++) 8724int count = Controls.Count; 8748if (Controls.Count == 0) 9137if (ChildControls is { } children && children.Count > 0) 9139controlSnapshot = new Control[children.Count]; 9140for (int i = 0; i < children.Count; i++) 9405for (int i = 0; i < children.Count; i++) 9494for (int i = 0; i < children.Count; i++) 9567for (int i = 0; i < children.Count; i++) 9786for (int i = 0; i < children.Count; i++)
System\Windows\Forms\Controls\Buttons\RadioButton.cs (2)
413for (int i = 0; i < children.Count; i++) 436for (int i = 0; i < children.Count; i++)
System\Windows\Forms\Controls\DataGridView\DataGridView.ControlCollection.cs (1)
50for (int i = 0; i < Count; i++)
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (1)
6240Debug.Assert(_editingPanel is null || _editingPanel.Controls.Count == 0);
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (1)
1095Debug.Assert(dataGridView.EditingPanel.Controls.Count == 0);
System\Windows\Forms\Controls\Menus\MenuStrip.cs (1)
206if (DisplayedItems.Count > 0)
System\Windows\Forms\Controls\Splitter\Splitter.cs (2)
648int count = children.Count; 722int count = children.Count;
System\Windows\Forms\Controls\TabControl\TabPage.TabPageAccessibleObject.cs (2)
33if (index < 0 || index > owningTabPage.Controls.Count - 1) 44=> this.IsOwnerHandleCreated(out TabPage? owningTabPage) ? owningTabPage.Controls.Count : -1;
System\Windows\Forms\Controls\ToolStrips\StatusStrip.cs (9)
337int itemCount = DisplayedItems.Count; 350if (itemCount != DisplayedItems.Count || (item is not null && (inDisplayedItemCollection != DisplayedItems.Contains(item)))) 381for (int i = 0; i < Items.Count; i++) 468for (int i = 0; i < DisplayedItems.Count; i++) 496TableLayoutSettings.ColumnCount = DisplayedItems.Count + 1; // add an extra cell so it fills the remaining space 499for (int i = DisplayedItems.Count; i < TableLayoutSettings.ColumnStyles.Count; i++) 515for (int i = 0; i < DisplayedItems.Count; i++) 545TableLayoutSettings.RowCount = DisplayedItems.Count + 1; // add an extra cell so it fills the remaining space 548for (int i = DisplayedItems.Count; i < TableLayoutSettings.RowStyles.Count; i++)
System\Windows\Forms\Controls\ToolStrips\ToolStrip.cs (32)
935LayoutTransaction.DoLayoutIf((Items.Count > 0), this, this, PropertyNames.ImageScalingSize); 1712for (int i = 0; i < Items.Count; i++) 1789ToolStripItem[] displayedItems = new ToolStripItem[DisplayedItems.Count]; 1914for (int i = Items.Count - 1; i >= 0; i--) 2072if (DisplayedItems.Count <= 0) 2083start ??= forward ? DisplayedItems[DisplayedItems.Count - 1] : DisplayedItems[0]; 2091int count = DisplayedItems.Count; 2145for (int i = 0; i < DisplayedItems.Count; i++) 2281for (int j = 0; j < toolStrip.Items.Count; j++) 2302if (toolStrip.Items.Count == 0 || (!foundItemParticipatingInLayout)) 2340for (int j = 0; j < toolStrip.Items.Count; j++) 2361if (toolStrip.Items.Count == 0 || !foundItemParticipatingInLayout) 2406for (int i = 0; i < DisplayedItems.Count; i++) 2522for (int i = 0; i < Items.Count; i++) 2528Invalidate(Controls.Count > 0); 2544for (int j = 0; j < DisplayedItems.Count; j++) 2890for (int i = 0; i < DisplayedItems.Count; i++) 2894index = (index + 1) % DisplayedItems.Count; 2953for (int i = 0; i < DisplayedItems.Count; i++) 2956index = (index + 1) % DisplayedItems.Count; 3144for (int i = 0; i < Items.Count; i++) 3171for (int i = 0; i < Items.Count; i++) 3264for (int j = 0; j < Items.Count; j++) 3501for (int i = 0; i < DisplayedItems.Count; i++) 3617for (int i = 0; i < Items.Count; i++) 3889for (int i = 0; i < DisplayedItems.Count; i++) 3941if (toolStripItem is ToolStripDropDownItem dropDownItem && dropDownItem.DropDownItems.Count > 0) 4268for (; j >= 0 && j < Items.Count; j = (pass == 0) ? j + 1 : j - 1) 4317if (OverflowItems.Count == 0) 4334for (int j = 0; j < Items.Count; j++) 4479return $"{base.ToString()}, Name: {Name}, Items: {Items.Count}"; 4710int i = Items.Count;
System\Windows\Forms\Controls\ToolStrips\ToolStrip.ToolStripAccessibleObject.cs (14)
57if (index < owner.Items.Count) 63for (int i = 0; i < owner.Items.Count; ++i) 80for (int i = 0; i < owner.Items.Count; ++i) 109if (owner.CanOverflow && owner.OverflowButton.Visible && index == owner.Items.Count) 129for (int i = 0; i < owner.Items.Count; i++) 164&& fragmentIndex == items.Count - 1) 169if (fragmentIndex < items.Count) 216for (int i = index + 1; i < items.Count; i++) 266return owner.OverflowItems.Count; 276return owner.DisplayedItems.Count; 312for (int index = 0; index < items.Count; index++) 344return owner.Items.Count + index; 348for (int i = 0; i < owner.Items.Count; ++i) 362for (int i = 0; i < owner.Items.Count; ++i)
System\Windows\Forms\Controls\ToolStrips\ToolStripDropDown.cs (1)
1592CancelEventArgs openEventArgs = new(cancel: DisplayedItems.Count == 0);
System\Windows\Forms\Controls\ToolStrips\ToolStripDropDownItem.cs (1)
708if (_dropDown.IsAutoGenerated && DropDownItems.Count <= 0)
System\Windows\Forms\Controls\ToolStrips\ToolStripDropDownItemAccessibleObject.cs (3)
130for (int i = 0; i < _owner.DropDownItems.Count; i++) 153for (int i = 0; i < _owner.DropDownItems.Count; i++) 195if (index >= 0 && index < dropDown.DisplayedItems.Count)
System\Windows\Forms\Controls\ToolStrips\ToolStripDropDownMenu.cs (10)
282for (int i = 0; i < Items.Count; i++) 621if (Items.Count > 0) 644if (!RequiresScrollButtons || Items.Count == 0) 663for (int i = 0; i < Items.Count && deltaToScroll < requiredScrollAmount; ++i) 667Rectangle adjustedLastItemBounds = Items[Items.Count - 1].Bounds; 677if (i < Items.Count - 1) 690for (int i = Items.Count - 1; i >= 0 && deltaToScroll > requiredScrollAmount; --i) 734if (_indexOfFirstDisplayedItem == -1 || _indexOfFirstDisplayedItem >= Items.Count) 760if (_indexOfFirstDisplayedItem == Items.Count - 1) 821for (int i = 0; i < Items.Count; ++i)
System\Windows\Forms\Controls\ToolStrips\ToolStripDropTargetManager.cs (1)
33for (int i = 0; i < _owner.Items.Count; i++)
System\Windows\Forms\Controls\ToolStrips\ToolStripItem.cs (1)
3559int i = 0, count = items.Count;
System\Windows\Forms\Controls\ToolStrips\ToolStripItemCollection.cs (10)
148for (int i = 0; i < toolStripItems.Count; i++) 170if (Count == 0) 186while (Count != 0) 188RemoveAt(Count - 1); 252for (int i = 0; i < itemsToLookIn.Count; i++) 268for (int j = 0; j < itemsToLookIn.Count; j++) 353for (int i = 0; i < Count; i++) 372return ((index >= 0) && (index < Count)); 429if (index < Count && index >= 0) 481if (index == Count)
System\Windows\Forms\Controls\ToolStrips\ToolStripManager.cs (15)
992for (int i = 0; i < controlsToLookIn.Count; i++) 1006for (int i = 0; i < controlsToLookIn.Count; i++) 1013if ((controlsToLookIn[i].Controls is not null) && controlsToLookIn[i].Controls.Count > 0) 1038for (int i = 0; i < destinationItems.Count; i++) 1050if (result is null && source.MergeIndex > -1 && source.MergeIndex < destinationItems.Count) 1107int originalCount = sourceToolStrip.Items.Count; 1123int numberOfItemsMerged = lastCount - sourceToolStrip.Items.Count; 1125lastCount = sourceToolStrip.Items.Count; 1160if (item is ToolStripDropDownItem tsddownDest && source is ToolStripDropDownItem tsddownSrc && tsddownSrc.DropDownItems.Count != 0) 1162int originalCount = tsddownSrc.DropDownItems.Count; 1177int numberOfItemsMerged = lastCount - tsddownSrc.DropDownItems.Count; 1179lastCount = tsddownSrc.DropDownItems.Count; 1230int insertIndex = Math.Min(destinationItems.Count, source.MergeIndex); 1336historyItem.PreviousIndexCollection!.Insert(Math.Min(historyItem.PreviousIndex, historyItem.PreviousIndexCollection.Count), historyItem.TargetItem!); 1339historyItem.IndexCollection!.Insert(Math.Min(historyItem.Index, historyItem.IndexCollection.Count), historyItem.TargetItem!);
System\Windows\Forms\Controls\ToolStrips\ToolStripMenuItem.ToolStripMenuItemAccessibleObject.cs (1)
105int sizeOfSet = displayedItems.Count;
System\Windows\Forms\Controls\ToolStrips\ToolStripOverflow.cs (1)
135for (int j = 0; j < DisplayedItems.Count; j++)
System\Windows\Forms\Controls\ToolStrips\ToolStripOverflow.ToolStripOverflowAccessibleObject.cs (2)
17=> this.TryGetOwnerAs(out ToolStripOverflow? owner) && (index >= 0 || index < owner.DisplayedItems.Count) 25? owner.DisplayedItems.Count
System\Windows\Forms\Controls\ToolStrips\ToolStripOverflowButton.cs (1)
45public override bool HasDropDownItems => ParentInternal is not null && ParentInternal.OverflowItems.Count > 0;
System\Windows\Forms\Controls\ToolStrips\ToolStripPanel.cs (16)
290ToolStripPanelRow[] rows = new ToolStripPanelRow[RowsInternal.Count]; 517if (Controls.Count > 0) 521Control[] controls = new Control[Controls.Count]; 522Point[] controlLocations = new Point[Controls.Count]; 615if (controls is not null && controls.Count > 0) 620Control[] controlArray = new Control[controls.Count]; 624int numRows = RowsInternal.Count; 657if (numRows < RowsInternal.Count || forceLayout) 727if (row >= RowsInternal.Count) 864int index = RowsInternal.Count; 879if (RowsInternal.Count > 0) 892&& previousRow.ControlsInternal.Count == 1 918if (currentToolStripPanelRow is not null && currentToolStripPanelRow.ControlsInternal.Count == 1) 936if (currentToolStripPanelRow is not null && currentToolStripPanelRow.ControlsInternal.Count > 1) 954for (int i = 0; i < RowsInternal.Count; i++) 1055for (int i = 0; i < RowsInternal.Count; i++)
System\Windows\Forms\Controls\ToolStrips\ToolStripPanel.ToolStripPanelRowCollection.cs (4)
77int currentCount = value.Count; 100while (Count != 0) 102RemoveAt(Count - 1); 156if (index < Count && index >= 0)
System\Windows\Forms\Controls\ToolStrips\ToolStripPanelCell.cs (1)
307if (ToolStripPanelRow.Cells[ToolStripPanelRow.Cells.Count - 1] == this)
System\Windows\Forms\Controls\ToolStrips\ToolStripPanelRow.cs (21)
76Control[] controls = new Control[ControlsInternal.Count]; 331if (ControlsInternal.Count <= 0) 353for (int i = 0; i < Cells.Count; i++) 385ToolStripPanelCell? cell = RowManager.GetNextVisibleCell(Cells.Count - 1, forward: false); 408ToolStripPanelCell? cell = RowManager.GetNextVisibleCell(Cells.Count - 1, forward: false); 429int[] margins = new int[Cells.Count]; 430for (int i = 0; i < Cells.Count; i++) 439for (int i = 0; i < Cells.Count; i++) 455for (int i = Cells.Count - 1; i >= 0; i--) 471for (int j = i + 1; j < Cells.Count; j++) 473cellOffsets ??= new int[Cells.Count]; 491for (int i = 0; i < Cells.Count; i++) 505ToolStripPanelCell? cell = RowManager.GetNextVisibleCell(Cells.Count - 1, forward: false); 526int[] margins = new int[Cells.Count]; 527for (int i = 0; i < Cells.Count; i++) 536for (int i = 0; i < Cells.Count; i++) 552for (int i = Cells.Count - 1; i >= 0; i--) 568for (int j = i + 1; j < Cells.Count; j++) 570cellOffsets ??= new int[Cells.Count]; 588for (int i = 0; i < Cells.Count; i++) 716if (ControlsInternal.Count == 0)
System\Windows\Forms\Controls\ToolStrips\ToolStripPanelRow.HorizontalRowManager.cs (21)
63if (index < ToolStripPanel.RowsInternal.Count - 1) 86for (int i = 0; i < Row.ControlsInternal.Count; i++) 107ToolStripPanelCell? lastCellOnRow = GetNextVisibleCell(Row.Cells.Count - 1, forward: false); 133spaceToFree -= MoveLeft(Row.Cells.Count - 1, spaceToFree); 211if (index + 1 < Row.Cells.Count) 240if (spaceToFree == 0 || index < 0 || index >= Row.ControlsInternal.Count) 249for (int i = index + 1; i < Row.Cells.Count; i++) 281if (Row.Cells.Count > 0 && (spaceToFree > freedSpace)) 283ToolStripPanelCell? lastCell = GetNextVisibleCell(Row.Cells.Count - 1, forward: false); 314for (int i = index + 1; i < Row.Cells.Count; i++) 331if (Row.Cells.Count == 1) 358if (index < Row.ControlsInternal.Count - 1 /*not the last one in the row*/) 401if (Row.ControlsInternal.Count > 0) 404for (index = 0; index < Row.Cells.Count; index++) 428if (index < Row.ControlsInternal.Count) 454if (index < Row.ControlsInternal.Count - 1) 489ToolStripPanelCell? nextCell = GetNextVisibleCell(Row.Cells.Count - 2, forward: false); 490ToolStripPanelCell? lastCell = GetNextVisibleCell(Row.Cells.Count - 1, forward: false); 531if (Row.Cells.Count > 0 || toolStripToDrag.IsInDesignMode) 534ToolStripPanelCell? cell = GetNextVisibleCell(Row.Cells.Count - 1, forward: false); 537cell = (ToolStripPanelCell)Row.Cells[Row.Cells.Count - 1];
System\Windows\Forms\Controls\ToolStrips\ToolStripPanelRow.ToolStripPanelRowControlCollection.cs (7)
111for (int i = 0; i < Count; i++) 131while (Count != 0) 133RemoveAt(Count - 1); 149if (index < Count && index >= 0) 160for (int i = 0; i < Count; i++) 192for (int i = 0; i < Count; i++) 273if (index >= 0 && index < Count)
System\Windows\Forms\Controls\ToolStrips\ToolStripPanelRow.ToolStripPanelRowManager.cs (3)
72if (index >= 0 && index < Row.ControlsInternal.Count - 1) 88for (int i = index; i < Row.Cells.Count; i++) 126for (int i = index + 1; i < Row.ControlsInternal.Count; i++)
System\Windows\Forms\Controls\ToolStrips\ToolStripPanelRow.VerticalRowManager.cs (24)
64if (index < ToolStripPanel.RowsInternal.Count - 1) 88for (int i = 0; i < Row.ControlsInternal.Count; i++) 109ToolStripPanelCell? lastCellOnRow = GetNextVisibleCell(Row.Cells.Count - 1, forward: false); 135spaceToFree -= MoveUp(Row.Cells.Count - 1, spaceToFree); 213if (index + 1 < Row.Cells.Count) 242if (spaceToFree == 0 || index < 0 || index >= Row.ControlsInternal.Count) 251for (int i = index + 1; i < Row.Cells.Count; i++) 283if (Row.Cells.Count > 0 && (spaceToFree > freedSpace)) 285ToolStripPanelCell? lastCell = GetNextVisibleCell(Row.Cells.Count - 1, forward: false); 309for (int i = index + 1; i < Row.Cells.Count; i++) 326if (Row.Cells.Count == 1) 351if (Row.Cells.Count > 0) 355ToolStripPanelCell? lastCell = GetNextVisibleCell(Row.Cells.Count - 1, forward: false); 361ToolStripPanelCell? lastCellOnRow = GetNextVisibleCell(Row.Cells.Count - 1, forward: false); 384MoveUp(Row.Cells.Count - 1, spaceToFree); 407if (Row.ControlsInternal.Count > 0) 410for (index = 0; index < Row.Cells.Count; index++) 434if (index < Row.ControlsInternal.Count) 461if (index < Row.ControlsInternal.Count - 1) 499ToolStripPanelCell? nextCell = GetNextVisibleCell(Row.Cells.Count - 2, forward: false); 500ToolStripPanelCell? lastCell = GetNextVisibleCell(Row.Cells.Count - 1, forward: false); 541if (Row.Cells.Count > 0) 543ToolStripPanelCell? cell = GetNextVisibleCell(Row.Cells.Count - 1, forward: false); 568if (index < Row.ControlsInternal.Count - 1 /*not the last one in the row*/)
System\Windows\Forms\Controls\ToolStrips\ToolStripScrollButton.StickyLabelAccessibleObject.cs (2)
31=> _owner.UpDirection && toolStripDropDownMenu.Items.Count > 0 35=> !_owner.UpDirection && toolStripDropDownMenu.Items.Count > 0
System\Windows\Forms\Controls\ToolStrips\ToolStripSettingsManager.cs (9)
74if (toolStrip.Items.Count == 0) 79StringBuilder itemNames = new(toolStrip.Items.Count); 81for (int i = 0; i < toolStrip.Items.Count; i++) 192for (int i = 0; ((i < toolStrip.Items.Count) && (i < keys.Length)); i++) 239for (int i = 0; i < controlsToLookIn.Count; i++) 255for (int i = 0; i < controlsToLookIn.Count; i++) 262if ((controlsToLookIn[i].Controls is not null) && controlsToLookIn[i].Controls.Count > 0) 289for (int i = 0; i < controlsCollection.Count; i++) 302for (int i = 0; i < controlsCollection.Count; i++)
System\Windows\Forms\Controls\ToolStrips\ToolStripSplitButton.ToolStripSplitButtonExAccessibleObject.cs (2)
82NavigateDirection.NavigateDirection_LastChild => DropDownItemsCount > 0 ? _owningToolStripSplitButton.DropDown.Items[_owningToolStripSplitButton.DropDown.Items.Count - 1].AccessibilityObject : null, 98return _owningToolStripSplitButton.DropDownItems.Count;
System\Windows\Forms\Controls\ToolStrips\ToolStripSplitStackDragDropHandler.cs (6)
124else if (toolStripItemIndex == -1 && _owner.Items.Count == 0) 159else if (_owner.Items.Count == 0) 172for (int i = 0; i < _owner.DisplayedItems.Count; i++) 183if (_owner.DisplayedItems.Count > 0) 185for (int i = 0; i < _owner.DisplayedItems.Count; i++) 198return _owner.Items.IndexOf(_owner.DisplayedItems[_owner.DisplayedItems.Count - 1]);
System\Windows\Forms\Controls\ToolStrips\ToolStripSplitStackLayout.cs (7)
67for (ForwardsWalkingIndex = 0; ForwardsWalkingIndex < toolStrip.Items.Count; ForwardsWalkingIndex++) 117for (ForwardsWalkingIndex = 0; ForwardsWalkingIndex < ToolStrip.Items.Count; ForwardsWalkingIndex++) 239for (int j = -1; j < toolStrip.Items.Count; j++) 381for (int j = -1; j < ToolStrip.Items.Count; j++) 523for (int i = 0; i < toolStrip.Items.Count; i++) 547for (int i = 0; i < toolStrip.Items.Count; i++) 567BackwardsWalkingIndex = (backIndex == -1) ? ToolStrip.Items.Count - 1 : backIndex - 1;
System\Windows\Forms\Form.cs (5)
3817if (Controls.Count > 1) 3819for (int index = 0; index < Controls.Count; index++) 6230numWindowListItems = MdiWindowListStrip.MergedMenu.MdiWindowListItem.DropDownItems.Count; 6240Debug.Assert(numWindowListItems == MdiWindowListStrip.MergedMenu.MdiWindowListItem.DropDownItems.Count, "Calling RevertMerge modified the mdiwindowlistitem"); 6287int nSubItems = sourceMenuStrip.MdiWindowListItem.DropDownItems.Count;
System\Windows\Forms\Layout\ArrangedElementCollection.cs (3)
26if (obj is not ArrangedElementCollection other || Count != other.Count) 31for (int i = 0; i < Count; i++)
System\Windows\Forms\Layout\CommonProperties.cs (1)
369for (int i = 0; i < controlsCollection.Count; i++)
System\Windows\Forms\Layout\Containers\ContainerControl.cs (4)
1039for (int i = 0; i < controlsCollection.Count; i++) 1059for (int i = 0; i < controlsCollection.Count; i++) 1251if (Controls.Count == 0) 1971int count = children.Count;
System\Windows\Forms\Layout\Containers\SplitContainer.cs (2)
1794if ((Panel1.Controls.Count > 0 || Panel2.Controls.Count > 0) || TabStop)
System\Windows\Forms\Layout\DefaultLayout.cs (7)
27for (int i = children.Count - 1; i >= 0; i--) 361for (int i = children.Count - 1; i >= 0; i--) 388for (int i = children.Count - 1; i >= 0; i--) 605if (!measureOnly && children.Count == 0) 613for (int i = children.Count - 1; i >= 0; i--) 699for (int i = 0; i < controls.Count; i++) 1117for (int i = children.Count - 1; i >= 0; i--)
System\Windows\Forms\Layout\FlowLayout.cs (5)
74for (int i = 0; i < container.Children.Count;) 81Debug.Assert(wrapContents || breakIndex == container.Children.Count, 99if (container.Children.Count != 0 && !measureOnly) 146endIndex: containerProxy.Container.Children.Count, 336for (int i = 1; i < collection.Count; i++)
System\Windows\Forms\Layout\TableLayout.ContainerInfo.cs (2)
237LayoutInfo[] childInfo = new LayoutInfo[children.Count]; 240for (int i = 0; i < children.Count; i++)
System\Windows\Forms\Layout\TableLayout.cs (6)
1299if (children is null || children.Count == 0) 1311for (int i = 0; i < children.Count; i++) 1335if (children is null || children.Count == 0) 1395List<LayoutInfo> childrenInfo = new(children.Count); 1399for (int i = 0; i < children.Count; i++) 1456List<LayoutInfo> layoutInfos = new(container.Children.Count);
System\Windows\Forms\MDI\MDIClient.cs (1)
243for (int i = 0; i < Controls.Count; i++)
System\Windows\Forms\MDI\MDIControlStrip.cs (1)
97Debug.Assert(Items.Count <= 4, "Too many items in the MDIControlStrip. How did we get into this situation?");
System\Windows\Forms\Panels\Panel.PanelAccessibleObject.cs (2)
24!this.IsOwnerHandleCreated(out Panel? owner) || index < 0 || index >= owner.Controls.Count 31=> this.IsOwnerHandleCreated(out Panel? owner) ? owner.Controls.Count : -1;
System\Windows\Forms\Panels\TableLayoutPanel\TableLayoutPanel.cs (1)
172return collection is not null && collection.Count > 0;
System\Windows\Forms\Panels\TableLayoutPanel\TableLayoutSettings.cs (1)
497List<ControlInformation> controlsInfo = new(Owner!.Children.Count);
System\Windows\Forms\Scrolling\ScrollableControl.cs (5)
335if (Controls.Count != 0) 347for (int i = 0; i < Controls.Count; i++) 400else if (Controls.Count != 0) 403for (int i = 0; i < Controls.Count; i++) 809for (int i = 0; i < Controls.Count; i++)
System.Windows.Forms.Design (88)
System\ComponentModel\Design\ToolStripContainerActionList.cs (3)
103&& root.Controls.Count > 1; 137|| root.Controls.Count <= 1) 152Control[] childControls = new Control[root.Controls.Count];
System\Drawing\Design\ColorEditor.ColorUI.ColorEditorTabControl.cs (1)
21if (selectedTab is not null && selectedTab.Controls.Count > 0)
System\Drawing\Design\ColorEditor.ColorUI.cs (1)
325if (selectedPage is not null && selectedPage.Controls.Count > 0)
System\Drawing\Design\ContentAlignmentEditor.ContentUI.cs (3)
434nextTabIndex = Controls.Count - 1; 436else if (nextTabIndex >= Controls.Count) 441for (int i = 0; i < Controls.Count; i++)
System\Windows\Forms\Design\Behavior\DropSourceBehavior.cs (2)
402numberOfOriginalTrayControls = tray is not null ? tray.Controls.Count : 0; 528int numberOfTrayControlsAdded = tray.Controls.Count - numberOfOriginalTrayControls;
System\Windows\Forms\Design\CommandSet.cs (3)
1786if (controlCommonParent.Controls.Count > 0) 1855int numberOfOriginalTrayControls = tray is not null ? tray.Controls.Count : 0; 2137int numberOfTrayControlsAdded = tray.Controls.Count - numberOfOriginalTrayControls;
System\Windows\Forms\Design\ComponentTray.cs (3)
227for (int i = 0; i < children.Count; ++i) 444get => Controls.Count; 1377int controlCount = Controls.Count;
System\Windows\Forms\Design\ControlCodeDomSerializer.cs (2)
299for (int i = 0; i < parent.Controls.Count; i++) 404for (int i = control.Controls.Count - 1; i >= 0; i--)
System\Windows\Forms\Design\ControlCommandSet.cs (8)
1142if (_baseControl is not null && _baseControl.Controls.Count > 0) 1392if (current.Controls.Count > 0) 1511if (ctlControls is not null && ctlControls.Count > 0) 1517for (int c = 0; c < ctlControls.Count; c++) 1545parentControlCount = parentControls.Count; 1613parentControlCount = parentControls.Count; 1679while (ctlControls is not null && ctlControls.Count > 0) 1686for (int c = ctlControls.Count - 1; c >= 0; c--)
System\Windows\Forms\Design\ControlDesigner.DesignerControlCollection.cs (2)
22public override int Count => _realCollection.Count; 70for (int i = _realCollection.Count - 1; i >= 0; i--)
System\Windows\Forms\Design\DesignerFrame.cs (1)
318List<ThemedScrollbarWindow> windows = new(Controls.Count);
System\Windows\Forms\Design\FlowLayoutPanelDesigner .cs (5)
171if (children.Count == 0) 178_childInfo = new ChildInfo[children.Count]; 197for (i = 0; i < children.Count; i++) 658_insertionIndex = children.Count; 886_insertionIndex = FlowLayoutPanel.Controls.Count;
System\Windows\Forms\Design\GroupedContextMenuStrip.cs (2)
54if (Items.Count > 0 && items.Count > 0) 80e.Cancel = (Items.Count == 0);
System\Windows\Forms\Design\ParentControlDesigner.cs (2)
608Control[] children = new Control[parent.Controls.Count]; 869int controlCount = control.Controls.Count;
System\Windows\Forms\Design\SplitterPanelDesigner.cs (2)
132if (_splitterPanel.Controls.Count == 0) 211if (_splitterPanel.Controls.Count == 0)
System\Windows\Forms\Design\TabControlDesigner.cs (2)
75_removeVerb.Enabled = Control.Controls.Count > 0; 118_removeVerb.Enabled = Control.Controls.Count > 0;
System\Windows\Forms\Design\TableLayoutPanelDesigner.cs (3)
1181for (int i = 0; i < Control.Controls.Count; i++) 2160public override int Count => _realCollection.Count; 2215for (int i = _realCollection.Count - 1; i >= 0; i--)
System\Windows\Forms\Design\TabOrder.cs (3)
361for (int n = 0; n < ctl.Controls.Count; n++) 420int count = control.Controls.Count; 430if (ctlTab.Controls.Count > 0)
System\Windows\Forms\Design\ToolStripCodeDomSerializer.cs (1)
18if (toolStrip.Items.Count == 0)
System\Windows\Forms\Design\ToolStripDesigner.cs (8)
905int count = ToolStrip.Items.Count; 1056if (ToolStrip.Items.Count > 1) 1058itemIndex = Math.Min(ToolStrip.Items.Count - 1, itemIndex); 1275if (ToolStrip.Items.Count > 0) 1277ToolStripItem[] items = new ToolStripItem[ToolStrip.Items.Count]; 1547index = parent.Controls.Count - 1; 1577index = parent.Controls.Count; 1960if (currentIndexOfEditor == -1 || currentIndexOfEditor != ToolStrip.Items.Count - 1)
System\Windows\Forms\Design\ToolStripDropDownDesigner.cs (3)
626int count = _dropDown.Items.Count - 1; 667if (_dropDown.Items.Count > 0) 669ToolStripItem[] items = new ToolStripItem[_dropDown.Items.Count];
System\Windows\Forms\Design\ToolStripItemDesigner.cs (2)
540if (item is ToolStripDropDownItem dropDownItem && dropDownItem.DropDownItems.Count > 1 /*including TN*/) 562if (item is ToolStripDropDownItem dropDownItem && dropDownItem.DropDownItems.Count > 1 /*including TN*/)
System\Windows\Forms\Design\ToolStripKeyboardHandlingService.cs (10)
336parentControlCount = parentControls.Count; 391parentControlCount = parentControls.Count; 683int count = parent.Items.Count; 728int count = parent.Items.Count; 1703next = current.Controls.Count > 0 ? current.Controls[0] : (object)current; 1829targetSelection = !backwards ? collection[0] : (object)collection[wb.Items.Count - 1]; 1970targetSelection = collection.Count >= 2 ? collection[collection.Count - 2] : GetNextControlInTab(baseCtl, parent, !backwards); 2025object[] totalObjects = new object[parent.Items.Count - 1]; 2026for (int i = 0; i < parent.Items.Count - 1; i++)
System\Windows\Forms\Design\ToolStripMenuItemDesigner.cs (12)
135if (MenuItem.DropDown.IsAutoGenerated && MenuItem.DropDownItems.Count > 0) 154ToolStripItem[] items = new ToolStripItem[MenuItem.DropDownItems.Count]; 701if (MenuItem.DropDownItems.Count == 0) 951if (index != -1 && MenuItem.DropDownItems.Count > index) 1160if (ddi.DropDown.Site is not null || ddi.DropDownItems.Count == 1) 1387for (int i = 0; i < wb.Items.Count; i++) 1693int count = MenuItem.DropDownItems.Count; 1907if (ownerItem.DropDownItems.Count > 1) 1909itemIndex = Math.Min(ownerItem.DropDownItems.Count - 1, itemIndex); 2034if (currentIndexOfEditor >= 0 && currentIndexOfEditor < MenuItem.DropDown.Items.Count - 1) 2317if (ownerItem.DropDownItems.Count > 0 && ownerItem.DropDownItems[0] is DesignerToolStripControlHost) 2446count = MenuItem.DropDownItems.Count;
System\Windows\Forms\Design\ToolStripPanelDesigner.cs (1)
391if (Control.Controls.Count == 0)
System\Windows\Forms\Design\ToolStripTemplateNode.cs (3)
1439if (_addItemButton.DropDownItems.Count > 0) 1451Debug.Assert(_addItemButton.DropDownItems.Count > 0); 1667for (int i = 0; i < Items.Count; i++)
System.Windows.Forms.Design.Tests (3)
System\Windows\Forms\Design\GroupedContextMenuStripTests.cs (3)
15groupedContextMenuStrip.Items.Count.Should().Be(0); 28groupedContextMenuStrip.Items.Count.Should().Be(1); 44groupedContextMenuStrip.Items.Count.Should().Be(3);
System.Windows.Forms.Tests (31)
BindingNavigatorTests.cs (1)
113Assert.Equal(11, bn.Items.Count);
System\Windows\Forms\AccessibleObjects\ToolStripMenuItem.ToolStripMenuItemAccessibleObjectTests.cs (4)
143Assert.Equal(2, menuStrip.Items.Count); 151Assert.Equal(3, menuStrip.Items.Count); 183Assert.Equal(2, menuStrip.Items.Count); 191Assert.Equal(3, menuStrip.Items.Count);
System\Windows\Forms\MdiControlStripTests.cs (1)
66Assert.Equal(2, mdiControlStrip.DisplayedItems.Count);
System\Windows\Forms\PropertyGridTests.cs (1)
73Assert.Equal(4, control.Controls.Count);
System\Windows\Forms\StatusStripTests.cs (5)
743Assert.Equal(expectedChildrenCallCount1, control.Controls.Count); 749Assert.Equal(expectedChildrenCallCount1, control.Controls.Count); 755Assert.Equal(expectedChildrenCallCount2, control.Controls.Count); 1033Assert.Equal(expectedChildrenCallCount1, control.Controls.Count); 1044Assert.Equal(expectedChildrenCallCount1, control.Controls.Count);
System\Windows\Forms\ToolStripDropDownTests.cs (1)
4891for (int i = 1; i < items.Count; i++) // it needs for correct work of ToolStrip.GetNextItemVertical method
System\Windows\Forms\ToolStripItemCollectionTests.cs (3)
120Assert.Equal(3, contextMenuStrip.Items.Count); 139collection.Count.Should().Be(2); 269collection.Count.Should().Be(1);
System\Windows\Forms\ToolStripMenuItemTests.cs (1)
250item.DropDownItems.Count.Should().Be(2);
System\Windows\Forms\ToolStripPanel.ToolStripPanelRowCollectionTests.cs (10)
52toolStripPanelRowCollection.Count.Should().Be(1); 62_toolStripPanelRowCollection.Count.Should().Be(2); 80_toolStripPanelRowCollection.Count.Should().Be(1); 116_toolStripPanelRowCollection.Count.Should().Be(4); 142_toolStripPanelRowCollection.Count.Should().Be(2); 146_toolStripPanelRowCollection.Count.Should().Be(0); 159_toolStripPanelRowCollection.Count.Should().Be(0); 172_toolStripPanelRowCollection.Count.Should().Be(0); 191_toolStripPanelRowCollection.Count.Should().Be(1); 211_toolStripPanelRowCollection.Count.Should().Be(1);
System\Windows\Forms\ToolStripSplitStackDragDropHandlerTests.cs (1)
67_toolStrip.Items.Count.Should().Be(0);
System\Windows\Forms\ToolStripTests.cs (2)
7356while (listToolStripMenuItem.DropDownItems.Count > 0) 7357listToolStripMenuItem.DropDownItems[listToolStripMenuItem.DropDownItems.Count - 1].Dispose();
ToolStripContainerTests.cs (1)
37_toolStripContainer.Controls.Count.Should().Be(5);
WinFormsControlsTest (1)
MainForm.cs (1)
295(int)Math.Ceiling((overarchingFlowLayoutPanel.Controls.Count + 1) / 3.0) * (biggestButton.Height + padding * 2)