Le texte est pivoté lorsque vous utilisez DrawText () sur Bitmap?

Je veux dessiner le texte sur Bitmap et je l’ai fait avec le code de résumé ci-dessous

BITMAPINFO bitmapInfo; bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bitmapInfo.bmiHeader.biWidth = _imgWidth; bitmapInfo.bmiHeader.biHeight = _imgHeight; bitmapInfo.bmiHeader.biPlanes = 1; bitmapInfo.bmiHeader.biBitCount = 24; bitmapInfo.bmiHeader.biCompression = BI_RGB; bitmapInfo.bmiHeader.biSizeImage = 0; HDC hdc = GetDC(NULL); if (hdc == NULL) return false; HFONT hFont = CreateFont( 50, 0, 0, 0, FW_BOLD, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, 0, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial" ); if(hFont == NULL) return false; HBITMAP hBitmap = CreateDIBitmap(hdc, (LPBITMAPINFOHEADER) &bitmapInfo.bmiHeader, CBM_INIT, _BRG24arrayIn, (LPBITMAPINFO) &bitmapInfo, DIB_RGB_COLORS); if(hBitmap == NULL) return false; HDC hMemDC = CreateCompatibleDC(hdc); if (hMemDC == NULL) return false; HBITMAP hBitmapOld = (HBITMAP)SelectObject(hMemDC, hBitmap); if( hBitmapOld == NULL ) return false; HFONT hFontOld = (HFONT)SelectObject(hMemDC, hFont); if ( hFontOld == NULL ) return false; SetBkMode(hMemDC, TRANSPARENT); SetTextColor(hMemDC, 0x0000FF00); RECT rect; SetRect(&rect, 0, 0, _imgWidth, _imgHeight); if (DrawText(hMemDC, "11:41:33", -1, &rect, DT_TOP|DT_LEFT) == 0) return false; GetDIBits(hdc, hBitmap, 0, _imgHeight, _BRG24arrayOut, (LPBITMAPINFO)&bitmapInfo, DIB_RGB_COLORS); return true; 

Le texte que je veux dessiner est "11:41:33" et l’alignement du texte est DT_TOP|DT_LEFT

Mais le résultat est que le texte est pivoté et est apparu sur le fond inférieur comme image de résultat ci-dessous

entrez la description de l'image ici

Le tableau d’entrée _BRG24arrayIn est au format BRG24 , quelqu’un peut me dire ce qu’il se passe?

Merci beaucoup,

T & TGroup!

Vous devez annuler la hauteur dans la structure BITMAPINFOHEADER pour obtenir un bitmap de haut en bas (c’est-à-dire une où la ligne 0 est en haut plutôt qu’en bas). Par exemple:

 bitmapInfo.bmiHeader.biHeight = -_imgHeight;