public GridLayer(RenderElement owner, int nColumns, int nRows, CellSizeStyle cellSizeStyle) : base(owner) { this.cellSizeStyle = cellSizeStyle; this.gridTable = new GridTable(); gridRows = gridTable.Rows; gridCols = gridTable.Columns; int columnWidth = owner.Width; if (nColumns > 0) { columnWidth = columnWidth / nColumns; uniformCellWidth = columnWidth; if (columnWidth < 1) { columnWidth = 1; } } //------------------------------------------------------------ int cx = 0; for (int c = 0; c < nColumns; c++) { GridColumn col = new GridColumn(columnWidth); col.Width = columnWidth; col.Left = cx; cx += columnWidth; gridCols.Add(col); } //------------------------------------------------------------ if (nRows > 0) { int rowHeight = owner.Height / nRows; int cy = 0; for (int r = 0; r < nRows; r++) { var row = new GridRow(rowHeight); gridRows.Add(row); row.Height = rowHeight; row.Top = cy; cy += rowHeight; } uniformCellHeight = rowHeight; } //------------------------------------------------------------ }
public void AddNewColumn(int initColumnWidth) { _gridCols.Add(new GridColumn(initColumnWidth)); }