private void ResizeGrid() { Tile[,] tempTileArr = new Tile[gridWidth, gridHeight]; Rectangle[,] tempRectArr = new Rectangle[gridWidth, gridHeight]; for (int i = 0; i < gridWidth; i++) { for (int j = 0; j < gridHeight; j++) { tempTileArr[i, j] = new Tile(Color.White); tempTileArr[i, j].Image = imageMap["empty"]; } } for (int i = 0; i < Math.Min(tiles.GetLength(0), tempTileArr.GetLength(0)); i++) for (int j = 0; j < Math.Min(tiles.GetLength(1), tempTileArr.GetLength(1)); j++) { tempTileArr[i, j].Image = tiles[i, j].Image; } tiles = tempTileArr; //gridPanel.Size = new Size(gridWidth * (rectSize + 5), gridHeight * (rectSize + 5)); this.gridPanel.AutoScrollMargin = new System.Drawing.Size(origXMargin, origYMargin); this.gridPanel.AutoScrollMinSize = new System.Drawing.Size(rectSize * (tiles.GetLength(0) + initScrollOffsetX), (rectSize / 2) * (tiles.GetLength(1) + initScrollOffsetY)); paintOffsetX = 0F; paintOffsetY = 0F; // 18000 is based of 30x30 iniDrawOffsetX was 600 and 90x30 was 200 so that gave 18000 / 30 and 90 initDrawOffsetX = 18000 / gridWidth; }