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));
639PropertyDescriptor colProp = TypeDescriptor.GetProperties(Table)["ColumnCount"];
640colProp?.SetValue(Table, DesignerUtils.s_defaultColumnCount);
642PropertyDescriptor rowProp = TypeDescriptor.GetProperties(Table)["RowCount"];
643rowProp?.SetValue(Table, DesignerUtils.s_defaultRowCount);
654Table.ColumnStyles[0].SizeType = SizeType.Percent;
655Table.ColumnStyles[0].Width = DesignerUtils.s_minimumStylePercent;
656Table.ColumnStyles[1].SizeType = SizeType.Percent;
657Table.ColumnStyles[1].Width = DesignerUtils.s_minimumStylePercent;
660Table.RowStyles[0].SizeType = SizeType.Percent;
661Table.RowStyles[0].Height = DesignerUtils.s_minimumStylePercent;
662Table.RowStyles[1].SizeType = SizeType.Percent;
663Table.RowStyles[1].Height = DesignerUtils.s_minimumStylePercent;
719if (Table.GrowStyle != TableLayoutPanelGrowStyle.FixedSize)
731int rowSpan = Table.GetRowSpan(newControl);
732int columnSpan = Table.GetColumnSpan(newControl);
735int numRows = Table.GetRowHeights().Length;
736int numColumns = Table.GetColumnWidths().Length;
755if (Table.GetControlFromPosition(column, row) is not null)
815if (Table is not null)
817Table.ControlAdded -= OnControlAdded;
818Table.ControlRemoved -= OnControlRemoved;
834if (Table.CellBorderStyle != TableLayoutPanelCellBorderStyle.None)
846int[] cw = Table.GetColumnWidths();
847int[] rh = Table.GetRowHeights();
853bool isRTL = (Table.RightToLeft == RightToLeft.Yes);
905int[] cw = Table.GetColumnWidths();
906int[] rh = Table.GetRowHeights();
908Table.SuspendLayout();
912if (cw.Length > Table.ColumnStyles.Count)
914int colDifference = cw.Length - Table.ColumnStyles.Count;
918Table.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, DesignerUtils.s_minimumStyleSize));
925if (rh.Length > Table.RowStyles.Count)
927int rowDifference = rh.Length - Table.RowStyles.Count;
931Table.RowStyles.Add(new RowStyle(SizeType.Absolute, DesignerUtils.s_minimumStyleSize));
939Table.ResumeLayout();
959int[] rows = Table.GetRowHeights();
960int[] columns = Table.GetColumnWidths();
963Point startingPoint = Table.PointToScreen(Table.DisplayRectangle.Location);
964Rectangle bounds = new(startingPoint, Table.DisplayRectangle.Size);
968bool isRTL = Table.RightToLeft == RightToLeft.Yes;
1044TableLayoutPanelCellPosition pos = Table.GetPositionFromControl(control);
1069Point loc = BehaviorService.MapAdornerWindowPoint(Table.Handle, Table.DisplayRectangle.Location);
1070Rectangle bounds = new(loc, Table.DisplayRectangle.Size);
1075int[] cw = Table.GetColumnWidths();
1076int[] rh = Table.GetRowHeights();
1079bool isRTL = (Table.RightToLeft == RightToLeft.Yes);
1110Debug.Assert(Table.ColumnStyles[i] is not null, "Table's ColumnStyle[" + i + "] is null!");
1111if (Table.ColumnStyles[i] is not null)
1113TableLayoutPanelResizeGlyph g = new(gBounds, Table.ColumnStyles[i], Cursors.VSplit, Behavior);
1136Debug.Assert(Table.RowStyles[i] is not null, $"Table's RowStyle[{i}] is null!");
1137if (Table.RowStyles[i] is not null)
1139TableLayoutPanelResizeGlyph g = new(gBounds, Table.RowStyles[i], Cursors.HSplit, Behavior);
1169_rowStyleProp = TypeDescriptor.GetProperties(Table)["RowStyles"];
1170_colStyleProp = TypeDescriptor.GetProperties(Table)["ColumnStyles"];
1196_rowCountBeforeAdd = Math.Max(0, Table.GetRowHeights().Length); // don't want negative
1197_colCountBeforeAdd = Math.Max(0, Table.GetColumnWidths().Length);
1214int[] rows = Table.GetRowHeights();
1215int[] columns = Table.GetColumnWidths();
1221if (Table.GetControlFromPosition(column, row) is not null)
1252Table.SetCellPosition(e.Control, new TableLayoutPanelCellPosition(-1, -1));
1261int[] rows = Table.GetRowHeights();
1262int[] columns = Table.GetColumnWidths();
1309if (dragControl is not null && Table.Controls.Contains(dragControl))
1336_rowCountBeforeAdd = Math.Max(0, Table.GetRowHeights().Length); // don't want negative
1337_colCountBeforeAdd = Math.Max(0, Table.GetColumnWidths().Length);
1467if (selSvc is not null && Table is not null)
1474if (c is not null && c.Parent == Table)
1481if (selSvc.GetComponentSelected(Table) || selectedComponentHasTableParent)
1484Table.SuspendLayout();
1486Table.ResumeLayout(false);
1487Table.PerformLayout();
1593switch (isRow ? Table.RowStyles[_curRow].SizeType : Table.ColumnStyles[_curCol].SizeType)
1609if ((isRow ? Table.RowCount : Table.ColumnCount) < 2)
1622if (host is not null && Table.Site is not null)
1627: SR.TableLayoutPanelDesignerAddColumnUndoUnit, Table.Site.Name));
1631Table.SuspendLayout(); // To avoid flickering
1635InsertRowCol(isRow, isRow ? Table.RowCount : Table.ColumnCount);
1636Table.ResumeLayout();
1663PropertyDescriptor rowProp = TypeDescriptor.GetProperties(Table)["RowCount"];
1667Table.RowStyles.Insert(index, new RowStyle(SizeType.Absolute, DesignerUtils.s_minimumStyleSize));
1670rowProp.SetValue(Table, Table.RowCount + 1);
1675PropertyDescriptor colProp = TypeDescriptor.GetProperties(Table)["ColumnCount"];
1679Table.ColumnStyles.Insert(index, new ColumnStyle(SizeType.Absolute, DesignerUtils.s_minimumStyleSize));
1682colProp.SetValue(Table, Table.ColumnCount + 1);
1698PropertyDescriptor childProp = TypeDescriptor.GetProperties(Table)["Controls"];
1701foreach (Control child in Table.Controls)
1703int currentIndex = isRow ? Table.GetRow(child) : Table.GetColumn(child);
1723int span = isRow ? Table.GetRowSpan(child) : Table.GetColumnSpan(child); // span is always at least 1
1737if (host is not null && Table.Site is not null)
1742Table.Site.Name));
1746Table.SuspendLayout();
1749Table.ResumeLayout();
1773PropertyDescriptor childProp = TypeDescriptor.GetProperties(Table)["Controls"];
1776foreach (Control child in Table.Controls)
1778int currentIndex = isRow ? Table.GetRow(child) : Table.GetColumn(child);
1812int span = isRow ? Table.GetRowSpan(child) : Table.GetColumnSpan(child); // span is always at least 1
1828PropertyDescriptor rowProp = TypeDescriptor.GetProperties(Table)["RowCount"];
1831rowProp.SetValue(Table, Table.RowCount - 1);
1834Table.RowStyles.RemoveAt(index);
1840PropertyDescriptor colProp = TypeDescriptor.GetProperties(Table)["ColumnCount"];
1843colProp.SetValue(Table, Table.ColumnCount - 1);
1846Table.ColumnStyles.RemoveAt(index);
1854if ((isRow ? Table.RowCount : Table.ColumnCount) < 2)
1861if (host is not null && Table.Site is not null)
1865Table.Site.Name));
1869Table.SuspendLayout();
1882PropertyDescriptor childProp = TypeDescriptor.GetProperties(Table)["Controls"];
1899Table.ResumeLayout();
1916private void OnRemove(bool isRow) => OnRemoveInternal(isRow, isRow ? Table.RowCount - 1 : Table.ColumnCount - 1);
1937styles = isRow ? Table.RowStyles : Table.ColumnStyles;
1947int[] rh = Table.GetRowHeights();
1948int[] ch = Table.GetColumnWidths();
1958if (host is not null && Table.Site is not null)
1960using DesignerTransaction t = host.CreateTransaction(string.Format(SR.TableLayoutPanelDesignerChangeSizeTypeUndoUnit, Table.Site.Name));
1964Table.SuspendLayout();
1974Table.RowStyles[index].Height = rh[index];
1978Table.ColumnStyles[index].Width = ch[index];
1986Table.RowStyles[index].Height = DesignerUtils.s_minimumStylePercent;
1990Table.ColumnStyles[index].Width = DesignerUtils.s_minimumStylePercent;
2004Table.ResumeLayout();
2037EditorServiceContext.EditValue(this, Table, "ColumnStyles");
2111Table?.Invalidate(true);
2118_compSvc.OnComponentChanging(Table, prop);
2126_compSvc.OnComponentChanged(Table, prop, null, null);