public static GraphicsDeviceServicePenumbra AddRef(IntPtr windowHandle, int width, int height)
 {
     if (Interlocked.Increment(ref _referenceCount) == 1)
     {
         _singletonInstance = new GraphicsDeviceServicePenumbra(windowHandle, width, height);
     }
     return(_singletonInstance);
 }
 protected override void Dispose(bool disposing)
 {
     if (_graphicsDeviceService != null)
     {
         _graphicsDeviceService.Release(disposing);
         _graphicsDeviceService = null;
     }
     base.Dispose(disposing);
 }
 protected override void OnCreateControl()
 {
     if (!designMode)
     {
         _graphicsDeviceService = GraphicsDeviceServicePenumbra.AddRef(Handle, ClientSize.Width, ClientSize.Height);
         _chain = new SwapChainRenderTarget(_graphicsDeviceService.GraphicsDevice, Handle, ClientSize.Width,
                                            ClientSize.Height);
         Services.AddService <IGraphicsDeviceService>(_graphicsDeviceService);
         Initialize();
     }
     base.OnCreateControl();
 }