protected override void OnLoad(EventArgs e) { // Вычисление размеров фишек и формы Graphics grfx = CreateGraphics(); sizeTile = new Size((int)(2 * grfx.DpiX / 3), (int)(2 * grfx.DpiY / 3)); ClientSize = new Size(sizeTile.Width * nCols, sizeTile.Height * nRows); grfx.Dispose(); // Создание фишек for (int iRow = 0; iRow < nRows; iRow++) { for (int iCol = 0; iCol < nCols; iCol++) { int iNum = iRow * nCols + iCol + 1; if (iNum == nRows * nCols) { continue; } JeuDeTaquinTile tile = new JeuDeTaquinTile(iNum); tile.Parent = this; tile.Location = new Point(iCol * sizeTile.Width, iRow * sizeTile.Height); tile.Size = sizeTile; atile[iRow, iCol] = tile; } } ptBlank = new Point(nCols - 1, nRows - 1); Randomize(); }
protected override void OnLoad(EventArgs ea) { // Calculate the size of the tiles and the form. Graphics grfx = CreateGraphics(); sizeTile = new Size((int)(2 * grfx.DpiX / 3), (int)(2 * grfx.DpiY / 3)); ClientSize = new Size(nCols * sizeTile.Width, nRows * sizeTile.Height); grfx.Dispose(); // Create the tiles. for (int iRow = 0; iRow < nRows; iRow++) { for (int iCol = 0; iCol < nCols; iCol++) { int iNum = iRow * nCols + iCol + 1; if (iNum == nRows * nCols) { continue; } JeuDeTaquinTile tile = new JeuDeTaquinTile(iNum); tile.Parent = this; tile.Location = new Point(iCol * sizeTile.Width, iRow * sizeTile.Height); tile.Size = sizeTile; atile[iRow, iCol] = tile; } } ptBlank = new Point(nCols - 1, nRows - 1); Randomize(); }