public Form1(GameController ctl) { InitializeComponent(); theController = ctl; theWorld = theController.GetWorld(); theController.RegisterServerUpdateHandler(OnFrame); //Register OnFrame as the controller event handler theController.RegisterConnectionErrorHandler(UnlockMenuBar); //Register UnlockMenuBar as the controller event handler ClientSize = new Size(Constant.ClientSize, Constant.ClientSize + 35); drawingPanel = new DrawingPanel(theWorld); drawingPanel.Location = new Point(0, 35); drawingPanel.Size = new Size(Constant.ViewSize, Constant.ViewSize); drawingPanel.BackColor = Color.Black; this.Controls.Add(drawingPanel); // Set KeyPreview object to true to allow the form to process // the key before the control with focus processes it. this.KeyPreview = true; this.KeyDown += new KeyEventHandler(Form1_KeyDown); this.KeyUp += new KeyEventHandler(Form1_KeyUp); drawingPanel.MouseMove += new MouseEventHandler(Form1_MouseMove); drawingPanel.MouseDown += new MouseEventHandler(Form1_MouseDown); drawingPanel.MouseUp += new MouseEventHandler(Form1_MouseUp); FormClosed += OnExit; }