System\Windows\Forms\Design\TableLayoutPanelDesigner.cs (170)
53private TableLayoutPanelBehavior Behavior => _tlpBehavior ??= new TableLayoutPanelBehavior(Table, this, Component.Site);
55private TableLayoutColumnStyleCollection ColumnStyles => Table.ColumnStyles;
57private TableLayoutRowStyleCollection RowStyles => Table.RowStyles;
61get => Table.RowCount;
70Table.RowCount = value;
77get => Table.ColumnCount;
86Table.ColumnCount = value;
268if (Table is not null)
272bool colState = Table.ColumnCount > 1;
281bool rowState = Table.RowCount > 1;
411if (_owner.Table.ColumnCount > 1)
419if (_owner.Table.RowCount > 1)
448Table.ControlRemoved -= OnControlRemoved;
449Table.Controls.Remove(c);
450Table.ControlRemoved += OnControlRemoved;
455Table.ControlAdded -= OnControlAdded;
456Table.Controls.Add(c, col, row);
457Table.ControlAdded += OnControlAdded;
466if (Table.GrowStyle == TableLayoutPanelGrowStyle.AddRows)
468PropertyDescriptor rowProp = TypeDescriptor.GetProperties(Table)["RowCount"];
469rowProp?.SetValue(Table, Table.GetRowHeights().Length);
472newControlPosition.Y = Table.RowCount - 1;
474else if (Table.GrowStyle == TableLayoutPanelGrowStyle.AddColumns)
476PropertyDescriptor colProp = TypeDescriptor.GetProperties(Table)["ColumnCount"];
477colProp?.SetValue(Table, Table.GetColumnWidths().Length);
479newControlPosition.X = Table.ColumnCount - 1;
489PropertyDescriptor controlsProp = TypeDescriptor.GetProperties(Table)["Controls"];
598Table.SetCellPosition(control, new TableLayoutPanelCellPosition(newControlPosition.X, newControlPosition.Y));
642PropertyDescriptor colProp = TypeDescriptor.GetProperties(Table)["ColumnCount"];
643colProp?.SetValue(Table, DesignerUtils.s_defaultColumnCount);
645PropertyDescriptor rowProp = TypeDescriptor.GetProperties(Table)["RowCount"];
646rowProp?.SetValue(Table, DesignerUtils.s_defaultRowCount);
657Table.ColumnStyles[0].SizeType = SizeType.Percent;
658Table.ColumnStyles[0].Width = DesignerUtils.s_minimumStylePercent;
659Table.ColumnStyles[1].SizeType = SizeType.Percent;
660Table.ColumnStyles[1].Width = DesignerUtils.s_minimumStylePercent;
663Table.RowStyles[0].SizeType = SizeType.Percent;
664Table.RowStyles[0].Height = DesignerUtils.s_minimumStylePercent;
665Table.RowStyles[1].SizeType = SizeType.Percent;
666Table.RowStyles[1].Height = DesignerUtils.s_minimumStylePercent;
722if (Table.GrowStyle != TableLayoutPanelGrowStyle.FixedSize)
734int rowSpan = Table.GetRowSpan(newControl);
735int columnSpan = Table.GetColumnSpan(newControl);
738int numRows = Table.GetRowHeights().Length;
739int numColumns = Table.GetColumnWidths().Length;
758if (Table.GetControlFromPosition(column, row) is not null)
821if (Table is not null)
823Table.ControlAdded -= OnControlAdded;
824Table.ControlRemoved -= OnControlRemoved;
840if (Table.CellBorderStyle != TableLayoutPanelCellBorderStyle.None)
852int[] cw = Table.GetColumnWidths();
853int[] rh = Table.GetRowHeights();
859bool isRTL = (Table.RightToLeft == RightToLeft.Yes);
911int[] cw = Table.GetColumnWidths();
912int[] rh = Table.GetRowHeights();
914Table.SuspendLayout();
918if (cw.Length > Table.ColumnStyles.Count)
920int colDifference = cw.Length - Table.ColumnStyles.Count;
924Table.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, DesignerUtils.s_minimumStyleSize));
931if (rh.Length > Table.RowStyles.Count)
933int rowDifference = rh.Length - Table.RowStyles.Count;
937Table.RowStyles.Add(new RowStyle(SizeType.Absolute, DesignerUtils.s_minimumStyleSize));
945Table.ResumeLayout();
965int[] rows = Table.GetRowHeights();
966int[] columns = Table.GetColumnWidths();
969Point startingPoint = Table.PointToScreen(Table.DisplayRectangle.Location);
970Rectangle bounds = new(startingPoint, Table.DisplayRectangle.Size);
974bool isRTL = Table.RightToLeft == RightToLeft.Yes;
1050TableLayoutPanelCellPosition pos = Table.GetPositionFromControl(control);
1075Point loc = BehaviorService.MapAdornerWindowPoint(Table.Handle, Table.DisplayRectangle.Location);
1076Rectangle bounds = new(loc, Table.DisplayRectangle.Size);
1081int[] cw = Table.GetColumnWidths();
1082int[] rh = Table.GetRowHeights();
1085bool isRTL = (Table.RightToLeft == RightToLeft.Yes);
1116Debug.Assert(Table.ColumnStyles[i] is not null, "Table's ColumnStyle[" + i + "] is null!");
1117if (Table.ColumnStyles[i] is not null)
1119TableLayoutPanelResizeGlyph g = new(gBounds, Table.ColumnStyles[i], Cursors.VSplit, Behavior);
1142Debug.Assert(Table.RowStyles[i] is not null, $"Table's RowStyle[{i}] is null!");
1143if (Table.RowStyles[i] is not null)
1145TableLayoutPanelResizeGlyph g = new(gBounds, Table.RowStyles[i], Cursors.HSplit, Behavior);
1175_rowStyleProp = TypeDescriptor.GetProperties(Table)["RowStyles"];
1176_colStyleProp = TypeDescriptor.GetProperties(Table)["ColumnStyles"];
1202_rowCountBeforeAdd = Math.Max(0, Table.GetRowHeights().Length); // don't want negative
1203_colCountBeforeAdd = Math.Max(0, Table.GetColumnWidths().Length);
1220int[] rows = Table.GetRowHeights();
1221int[] columns = Table.GetColumnWidths();
1227if (Table.GetControlFromPosition(column, row) is not null)
1258Table.SetCellPosition(e.Control, new TableLayoutPanelCellPosition(-1, -1));
1267int[] rows = Table.GetRowHeights();
1268int[] columns = Table.GetColumnWidths();
1315if (dragControl is not null && Table.Controls.Contains(dragControl))
1342_rowCountBeforeAdd = Math.Max(0, Table.GetRowHeights().Length); // don't want negative
1343_colCountBeforeAdd = Math.Max(0, Table.GetColumnWidths().Length);
1473if (selSvc is not null && Table is not null)
1480if (c is not null && c.Parent == Table)
1487if (selSvc.GetComponentSelected(Table) || selectedComponentHasTableParent)
1490Table.SuspendLayout();
1492Table.ResumeLayout(false);
1493Table.PerformLayout();
1608switch (isRow ? Table.RowStyles[_curRow].SizeType : Table.ColumnStyles[_curCol].SizeType)
1624if ((isRow ? Table.RowCount : Table.ColumnCount) < 2)
1637if (host is not null && Table.Site is not null)
1642: SR.TableLayoutPanelDesignerAddColumnUndoUnit, Table.Site.Name));
1646Table.SuspendLayout(); // To avoid flickering
1650InsertRowCol(isRow, isRow ? Table.RowCount : Table.ColumnCount);
1651Table.ResumeLayout();
1678PropertyDescriptor rowProp = TypeDescriptor.GetProperties(Table)["RowCount"];
1682Table.RowStyles.Insert(index, new RowStyle(SizeType.Absolute, DesignerUtils.s_minimumStyleSize));
1685rowProp.SetValue(Table, Table.RowCount + 1);
1690PropertyDescriptor colProp = TypeDescriptor.GetProperties(Table)["ColumnCount"];
1694Table.ColumnStyles.Insert(index, new ColumnStyle(SizeType.Absolute, DesignerUtils.s_minimumStyleSize));
1697colProp.SetValue(Table, Table.ColumnCount + 1);
1713PropertyDescriptor childProp = TypeDescriptor.GetProperties(Table)["Controls"];
1716foreach (Control child in Table.Controls)
1718int currentIndex = isRow ? Table.GetRow(child) : Table.GetColumn(child);
1738int span = isRow ? Table.GetRowSpan(child) : Table.GetColumnSpan(child); // span is always at least 1
1752if (host is not null && Table.Site is not null)
1757Table.Site.Name));
1761Table.SuspendLayout();
1764Table.ResumeLayout();
1788PropertyDescriptor childProp = TypeDescriptor.GetProperties(Table)["Controls"];
1791foreach (Control child in Table.Controls)
1793int currentIndex = isRow ? Table.GetRow(child) : Table.GetColumn(child);
1827int span = isRow ? Table.GetRowSpan(child) : Table.GetColumnSpan(child); // span is always at least 1
1843PropertyDescriptor rowProp = TypeDescriptor.GetProperties(Table)["RowCount"];
1846rowProp.SetValue(Table, Table.RowCount - 1);
1849Table.RowStyles.RemoveAt(index);
1855PropertyDescriptor colProp = TypeDescriptor.GetProperties(Table)["ColumnCount"];
1858colProp.SetValue(Table, Table.ColumnCount - 1);
1861Table.ColumnStyles.RemoveAt(index);
1869if ((isRow ? Table.RowCount : Table.ColumnCount) < 2)
1876if (host is not null && Table.Site is not null)
1880Table.Site.Name));
1884Table.SuspendLayout();
1897PropertyDescriptor childProp = TypeDescriptor.GetProperties(Table)["Controls"];
1914Table.ResumeLayout();
1931private void OnRemove(bool isRow) => OnRemoveInternal(isRow, isRow ? Table.RowCount - 1 : Table.ColumnCount - 1);
1952styles = isRow ? Table.RowStyles : Table.ColumnStyles;
1962int[] rh = Table.GetRowHeights();
1963int[] ch = Table.GetColumnWidths();
1973if (host is not null && Table.Site is not null)
1975using DesignerTransaction t = host.CreateTransaction(string.Format(SR.TableLayoutPanelDesignerChangeSizeTypeUndoUnit, Table.Site.Name));
1979Table.SuspendLayout();
1989Table.RowStyles[index].Height = rh[index];
1993Table.ColumnStyles[index].Width = ch[index];
2001Table.RowStyles[index].Height = DesignerUtils.s_minimumStylePercent;
2005Table.ColumnStyles[index].Width = DesignerUtils.s_minimumStylePercent;
2019Table.ResumeLayout();
2052EditorServiceContext.EditValue(this, Table, "ColumnStyles");
2126Table?.Invalidate(true);
2133_compSvc.OnComponentChanging(Table, prop);
2141_compSvc.OnComponentChanged(Table, prop, null, null);