private void NextBlockPreview() { if (_nextBlockPanel == null) { return; } TetrisPanel.DrawLocker.WaitOne(); const int size = 30; int nextBlockNum = _block.NextBlockNum(); int[,] block = _block.BlockCreate(nextBlockNum, 0); using (Graphics g = _nextBlockPanel.CreateGraphics()) { int blockLen = block.GetLength(0); for (int y = 0; y < 2; y++) { for (int x = 0; x < 4; x++) { if (x >= blockLen || y >= blockLen || block[y, x] != 1) { g.FillRectangle(Brushes.Black, x * size, y * size, size, size); g.DrawRectangle(new Pen(Brushes.Black), x * size, y * size, size, size); } else { g.FillRectangle(_block.BlockColor[nextBlockNum], x * size, y * size, size, size); g.DrawRectangle(new Pen(Brushes.Black), x * size, y * size, size, size); } } } } TetrisPanel.DrawLocker.Release(); }