public void SetBackBuffer(SharpDX.Direct3D9.Texture texture) { if (texture == null) ReleaseBackBuffer(); else { using (Surface Surface = texture.GetSurfaceLevel(0)) { d3dImage.Lock(); d3dImage.SetBackBuffer(D3DResourceType.IDirect3DSurface9, Surface.NativePointer); d3dImage.Unlock(); } } }