title: How to draw text with transparent background using c++/WinAPI?
body: <p>How to draw text with transparent color using WinAPI?
  In usual way I used SetBkMode(hDC, TRANSPARENT), but now I need to use double buffer.
  In this way images draws correct, but text draws not correct (with black background).</p>
  
  <pre><code>case WM_PAINT:
  {
      hDC = BeginPaint(hWnd, &amp;paintStruct);
      SetBkMode(hDC, TRANSPARENT);
  
      HDC cDC = CreateCompatibleDC(hDC);
      HBITMAP hBmp = CreateCompatibleBitmap(hDC, width, height);
      HANDLE hOld = SelectObject(cDC, hBmp);
  
      HFONT hFont = (HFONT)SelectObject(hDC, font);
      SetTextColor(cDC, color);
      SetBkMode(cDC, TRANSPARENT);
  
      TextOut(cDC, 0, 0, text, wcslen(text));
  
      SelectObject(cDC, hFont);
  
      BitBlt(hDC, 0, 0, width, height, cDC, 0, 0, SRCCOPY);
  
      SelectObject(cDC, hOld);
      DeleteObject(hBmp);
      DeleteDC(cDC);
  
      EndPaint(hWnd, &amp;paintStruct);
      return 0;
  }
  </code></pre>