title: Resizing swapchain causes Bitmap not to be usable (SharpDX, directX)
body: <p>I want to resize my swapchain on screen resizing on my windows form application. When I do that, I need to dispose my older deviceContext, buffer, target etc...</p>
  
  <p>Look at the code below : </p>
  
  <pre><code>Public Overrides Sub Resize(Width As Integer, Height As Integer)
      m_backBuffer.Dispose()
      m_d2dContext.Dispose()
      m_2dTarget.Dispose()
  
  
      m_swapChain.ResizeBuffers(2, Width, Height, Format.R8G8B8A8_UNorm, SwapChainFlags.None)
      m_backBuffer = m_swapChain.GetBackBuffer(Of Surface)(0)
      Dim properties As BitmapProperties = New BitmapProperties(New SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.R8G8B8A8_UNorm, SharpDX.Direct2D1.AlphaMode.Premultiplied), 96, 96)
  
      Dim dxgiDevice As SharpDX.DXGI.Device = m_device.QueryInterface(Of SharpDX.DXGI.Device)()
  
      Dim d2dDevice As SharpDX.Direct2D1.Device = New SharpDX.Direct2D1.Device(dxgiDevice)
      m_d2dContext = New SharpDX.Direct2D1.DeviceContext(d2dDevice, SharpDX.Direct2D1.DeviceContextOptions.None)
  
      m_2dTarget = New SharpDX.Direct2D1.Bitmap(m_d2dContext, m_backBuffer, properties)
      m_d2dContext.Target = m_2dTarget
  
      CType(m_Context, GpuDrawingContext).setRenderTarget(m_d2dContext)
  
  End Sub
  </code></pre>
  
  <p>The problem when I do that, is that the bitmap I had previously created to display on screen needed a DeviceContext as a parameter for their creation. However, now that I am instanciating a new DeviceContext on resizing, I get the error WrongFactory when I want to draw the bitmap on the deviceContext because their aren't created with the same DeviceContext from where we want to draw them. </p>
  
  <p>Any solutions for the resize function ? </p>