private void Init() { gr = this.CreateGraphics(); height_in_cells = 24; width_in_cells = 11; cell_size = 20; menu = new Label(); menu.SetBounds(-10, 480, 237, 60); menu.BackColor = Color.Transparent; menu.Font = new Font("Courier New", 12, FontStyle.Bold); menu.TextAlign = ContentAlignment.MiddleCenter; this.Controls.Add(menu); this.FormBorderStyle = FormBorderStyle.Fixed3D; this.Height = 600; this.Width = 237; this.Text = "Tetris v.2.0"; this.Font = new Font("Courier New", 20, FontStyle.Bold); this.BackgroundImage = Image.FromFile(Environment.CurrentDirectory + @"\333.jpg"); board = new Board(height_in_cells, width_in_cells); current = new Tetromino(); current.GetTetromino(); game_timer = new Timer() { Interval = 1000, Enabled = true }; game_timer.Tick += DownShift; game_timer.Start(); this.KeyDown += MyForm_KeyDown; this.DoubleBuffered = true; this.Paint += MyForm_Paint; }
private void BlockRestart() { foreach (Coordinates c in current.pC) { board.field[c.pY, c.pX].pCellkind = CellKind.Block; } board.ClearBoard(); current = new Tetromino(); current.GetTetromino(); }