protected override void OnCreateControl() { if (!DesignMode) { services = new ServiceContainer(); graphicsDeviceService = GraphicsDeviceService.AddRef(Handle, Width, Height); services.AddService <IGraphicsDeviceService>(graphicsDeviceService); // Register the service, so components like ContentManager can find it. spriteBatch = new SpriteBatch(GraphicsDevice); content = new ContentManager(services, "Content"); viewport = new Viewport(); surfaceRectangle = new XNARectangle(0, 0, Width, Height); canUpdate = true; Initialize(); } base.OnCreateControl(); }