using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace IndividualProject { public partial class GameForm : Form { Form parentF = null; Bitmap bitmap = null; Graphics bitmapGraphics = null; SolidBrush blackSBrush = null; int gameRectW = 0; int gameRectH = 0; Map map = null; public GameForm(Form parentF) { this.parentF = parentF; InitializeComponent(); InitializePaintbox(); InitializateMap(); Repaint(); parentF.Visible = false; } private void InitializePaintbox() { //gameRectW = 760; //gameRectH = 700; gameRectW = gamePictureBox.Size.Width; gameRectH = gamePictureBox.Size.Height; bitmap = new Bitmap(gameRectW, gameRectH); bitmapGraphics = Graphics.FromImage(bitmap); blackSBrush = new SolidBrush(Color.Black); } private void Repaint() { bitmapGraphics.FillRectangle(blackSBrush, 0, 0, gameRectW, gameRectH); map.Repaint(bitmapGraphics); gamePictureBox.BackgroundImage = bitmap; } private void InitializateMap() { map = new Map(8,8,60); } private void GameForm_FormClosing(object sender, FormClosingEventArgs e){ parentF.Visible = true; } } }