Exemplo n.º 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;
            }
            //------------------------------------------------------------
        }
Exemplo n.º 2
0
        public GridLayer(RenderElement owner, CellSizeStyle cellSizeStyle, GridTable gridTable)
            : base(owner)
        {
            this.cellSizeStyle = cellSizeStyle;
            this.gridTable     = gridTable;

            gridRows = gridTable.Rows;
            gridCols = gridTable.Columns;
            int columnWidth = owner.Width;

            int nColumns = gridTable.ColumnCount;

            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 = owner.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;
            }
            //------------------------------------------------------------
        }
Exemplo n.º 3
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;
            }
            //------------------------------------------------------------
        }
Exemplo n.º 4
0
 internal void SetOwnerParentRowCollection(GridTable.GridRowCollection parentRowCollection)
 {
     this.parentRowCollection = parentRowCollection;
 }
Exemplo n.º 5
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;
                }
            }


            //------------------------------------------------------------
        }
Exemplo n.º 6
0
 internal void SetOwnerParentRowCollection(GridTable.GridRowCollection parentRowCollection)
 {
     this.parentRowCollection = parentRowCollection;
 }