예제 #1
0
파일: View.cs 프로젝트: Gallimathias/Tetris
        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.Clear(BackColor);

            using (var pen = new Pen(new SolidBrush(Color.Black)))
            {
                for (int x = 0; x < CellCountX; x++)
                {
                    for (int y = 0; y < CellCountY; y++)
                    {
                        e.Graphics.DrawRectangle(pen, new Rectangle(
                                                     x * CellWidth, y * CellHeight, CellWidth, CellHeight));
                    }
                }
            }

            game.OnDraw(e.Graphics);

            base.OnPaint(e);
        }