Exemple #1
0
        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;
            }
            //------------------------------------------------------------
        }
Exemple #2
0
 internal GridRowCollection(GridTable table)
 {
     this.table = table;
 }
Exemple #3
0
 internal GridColumnCollection(GridTable table)
 {
     this.table = table;
 }
Exemple #4
0
        public GridLayer(int width, int height, CellSizeStyle cellSizeStyle, GridTable gridTable)
        {
            _cellSizeStyle = cellSizeStyle;
            _gridTable     = gridTable;
            _gridRows      = gridTable.Rows;
            _gridCols      = gridTable.Columns;


            int nColumns = gridTable.ColumnCount;

            if (cellSizeStyle == CellSizeStyle.ColumnAndRow)
            {
                int cx = 0;
                for (int c = 0; c < nColumns; c++)
                {
                    GridColumn col   = _gridCols.GetColumn(c);
                    int        col_w = col.Width;
                    col.Left = cx;
                    cx      += col_w;
                }
                //------------------------------------------------------------
                int nRows = gridTable.RowCount;
                if (nRows > 0)
                {
                    int cy    = 0;
                    int row_h = 1;
                    for (int r = 0; r < nRows; r++)
                    {
                        GridRow row = _gridRows.GetRow(r);
                        row_h      = row.Height;
                        row.Height = row_h;
                        row.Top    = cy;
                        cy        += row_h;
                    }
                    _uniformCellHeight = row_h;
                }
            }
            else
            {
                int columnWidth = 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 = _gridCols.GetColumn(c);
                    col.Width = columnWidth;
                    col.Left  = cx;
                    cx       += columnWidth;
                }
                //------------------------------------------------------------
                int nRows = gridTable.RowCount;
                if (nRows > 0)
                {
                    int rowHeight = height / nRows;
                    int cy        = 0;
                    for (int r = 0; r < nRows; r++)
                    {
                        GridRow row = _gridRows.GetRow(r);
                        row.Height = rowHeight;
                        row.Top    = cy;
                        cy        += rowHeight;
                    }
                    _uniformCellHeight = rowHeight;
                }
            }


            //------------------------------------------------------------
        }
Exemple #5
0
 internal GridRowCollection(GridTable table)
 {
     this.table = table;
 }
Exemple #6
0
 internal GridColumnCollection(GridTable table)
 {
     this.table = table;
 }
Exemple #7
0
 internal void SetParentColumnCollection(GridTable.GridColumnCollection parentColumnCollection)
 {
     this.parentColumnCollection = parentColumnCollection;
 }
Exemple #8
0
 internal void SetOwnerParentRowCollection(GridTable.GridRowCollection parentRowCollection)
 {
     this.parentRowCollection = parentRowCollection;
 }