?
Ich habe noch nen Beispiel ausm Internet probiert was leider auch nix brachte.
//---------------------------------------------------------------------------
// Text GDI (mit Winkel)
void DirectDrawClass::DrawText(int startx, int starty, int ax, int ay, char *string,
int Height, bool Bold, bool Italic, bool Underline,
COLORREF TextColor, char *FontName, LPDIRECTDRAWSURFACE7 lpDDSurf)
{
HDC hDC;
HFONT hFont;
HBITMAP hBmp;
RECT rctTemp;
// DC für die Oberfläche anfordern
if(FAILED(lpDDSurf->GetDC(&hDC)))
{
Error("DC(Text) ist nicht verfügbar");
return ;
}
// Texthintergrund = TRANSPARENT
SetBkMode(hDC, TRANSPARENT);
// Textfarbe
SetTextColor(hDC, TextColor);
// Text linksbündig ausrichten
SetTextAlign(hDC, TA_LEFT);
SetMapMode(hDC, MM_TEXT);
int nXDpi=GetDeviceCaps(hDC, LOGPIXELSX);
int nYDpi=GetDeviceCaps(hDC, LOGPIXELSY);
int nWidth=(int)(8.5*(float)nXDpi);
int nHeight=11*nYDpi;
hBmp=CreateCompatibleBitmap(hDC, nWidth, nHeight);
SelectObject(hDC, hBmp);
SetRect(&rctTemp, 0, 0, nWidth, nHeight);
FillRect(hDC, &rctTemp, (HBRUSH)GetStockObject(WHITE_BRUSH));
hFont=CreateFont(-MulDiv(12, nYDpi, 72), 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_STRING_PRECIS, CLIP_STROKE_PRECIS, PROOF_QUALITY, DEFAULT_PITCH, FontName);
SelectObject(hDC, hFont);
SetRect(&rctTemp, (int)((float)nXDpi*0.5), (int)((float)nYDpi*0.5), nWidth-(int)((float)nXDpi*0.5), nHeight-(int)((float)nYDpi*0.5));
::DrawText(hDC, string, -1, &rctTemp, DT_LEFT|DT_TOP|DT_WORDBREAK);
DeleteObject(hBmp);
DeleteObject(hFont);
DeleteDC(hDC);
// Oberfläche wieder freigeben
lpDDSurf->ReleaseDC(hDC);
}
//---------------------------------------------------------------------------
Irgendeiner der weiss wie man es konstant bekommt?