   [SlimDX] Surface.GetDC() error
  Hey!Im trying to get the DC of a texture in Slimdx to performe BitBlt on it. Sadly the function GetDC returns me D3DERR_INVALIDCALL and i dont know why... Here is my code:public Bitmap AsBitmap()   {  if (m_texture == null) return null;  Surface surf = m_texture.GetSurfaceLevel(0);  IntPtr hDC = surf.GetDC(); // <--- D3DERR_INVALIDCALL  Graphics graph = Graphics.FromHdc(hDC);  Bitmap bmp = new Bitmap((int)Width, (int)Height, graph);  Graphics graBmp = Graphics.FromImage(bmp);  BitBlt(graBmp.GetHdc(), 0, 0, (int)Width, (int)Height, graph.GetHdc(), 0, 0, 0xCC0020);  graBmp.Dispose();  graph.Dispose();  return bmp;   }The texture is loaded without any errors and in a DirectX-context also correctly displayed./edit: Never mind, my texture has DXT3-format and according to MSDNs IDirect3DSurface9::GetDC its only defined for other formats. Well then, how can i transform my Surface to a Bitmap (with alpha)?/edit2:Never mind again:   public Bitmap AsBitmap()   {  if (m_texture == null) return null;  Surface surf = m_texture.GetSurfaceLevel(0);  SlimDX.DataStream stream = Surface.ToStream(surf, ImageFileFormat.Bmp);  Bitmap bmp = (Bitmap)Bitmap.FromStream(stream);  return bmp;   }/edit3:Its still not as it should be. Alpha is not preserved and what was transparent in the texture in the bitmap now is black. How can i tell the bitmap that it should also accept alpha and transparency?GreetingsPlerion[Edited by - Plerion on May 26, 2010 3:50:23 AM]
  Support for transparent bitmap (BMP format) is obviously not directly possible, this is a lack of the .NET framework. Use PNG instead.SlimDX.DataStream stream = Surface.ToStream(surf, ImageFileFormat.Png);Hope that helps   ;  Ah, yes, thanks, already tried that and it helped, sometimes trying is the right way :D   