Ejemplo n.º 1
0
        protected virtual void InitCells(int totalCells)
        {
            Size cellSize   = new MemoryCell(new Point(0, 0), 0, 0).GetSize();
            int  cellHeight = cellSize.Height;

            int cellCenterX     = this.Center.X;
            int initCellCenterY = this.Center.Y - (cellHeight / 2) * (totalCells - 1);

            for (int cellNumber = 0; cellNumber < totalCells; cellNumber++)
            {
                int offsetY     = cellNumber * cellHeight;
                int cellCenterY = initCellCenterY + offsetY;

                Point      cellCenter = new Point(cellCenterX, cellCenterY);
                MemoryCell cellToAdd  = new MemoryCell(cellCenter, cellNumber, totalCells);
                DataCells.Add(cellToAdd);
            }
        }
Ejemplo n.º 2
0
        public override Size GetSize()
        {
            Size size = new Size(40, 20);

            int totalCells = DataCells.Count;

            if (totalCells == 0)
            {
                return(size);
            }

            Size cellSize = DataCells.First().GetSize();

            int width  = cellSize.Width + 2 * padding;
            int height = totalCells * cellSize.Height + 2 * padding;

            size.Width  = width;
            size.Height = height;

            return(size);
        }