title: How to Render a Transparent Cursor to Bitmap preserving alpha channel?
body: <p>I use the code below to render a transparent icon:</p>
  
  <pre><code>    private void button1_Click(object sender, EventArgs e)
      {
          // using LoadCursorFromFile from user32.dll
          var cursor = NativeMethods.LoadCustomCursor(@"d:\Temp\Cursors\Cursors\aero_busy.ani");
  
          // cursor -&gt; bitmap
          Bitmap bitmap = new Bitmap(48, 48, PixelFormat.Format32bppArgb);
          Graphics gBitmap = Graphics.FromImage(bitmap);
          cursor.DrawStretched(gBitmap, new Rectangle(0, 0, 32, 32));
  
          // 1. Draw bitmap on a form canvas
          Graphics gForm = Graphics.FromHwnd(this.Handle);
          gForm.DrawImage(bitmap, 50, 50);
  
          // 2. Draw cursor directly to a form canvas
          cursor.Draw(gForm, new Rectangle(100, 50, 32, 32));
  
          cursor.Dispose();
      }
  </code></pre>
  
  <p>Unfortunately I am unable to render a transparent Cursor to Bitmap! It works when I draw Cursor directly to the form canvas, but there is a problem when I draw Cursor to bitmap.
  Any advice is highly appreciated.</p>
  
  <p><img src="https://i.stack.imgur.com/mVqLu.jpg" alt="alt text"></p>