/// <summary> /// Disposes the control. /// </summary> protected override void Dispose(bool disposing) { if (graphicsDeviceService != null) { graphicsDeviceService.Release(disposing); graphicsDeviceService = null; } base.Dispose(disposing); }
/// <summary> /// Initializes the control. /// </summary> protected override void OnCreateControl() { // Don't initialize the graphics device if we are running in the designer. if (!DesignMode) { graphicsDeviceService = new GraphicsDeviceService(Handle, ClientSize.Width, ClientSize.Height); // Give derived classes a chance to initialize themselves. Initialize(); graphics.Device = graphicsDeviceService.GraphicsDevice; graphics.InitializeDevice(); PreviewKeyDown += new PreviewKeyDownEventHandler(GraphicsDeviceControl_PreviewKeyDown); } base.OnCreateControl(); }