PDA

Click to See Complete Forum and Search --> : text color


SteveCRM
Mar 21st, 2002, 06:25 PM
for now I use this function for font (thanks to a one mr parksie ;) )

void SetFont(HWND hWnd, int iPointSize, const char *pcFontName) { //(obviously) sets fonts of controls

HFONT hTheFont;
HDC hDC = GetDC(hWnd);
int nHeight = -MulDiv(iPointSize, GetDeviceCaps(hDC, LOGPIXELSY), 72);

hTheFont = CreateFont(nHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, pcFontName);

ReleaseDC(hWnd, hDC);

SendMessage(hWnd, WM_SETFONT, (WPARAM)hTheFont, TRUE);
}

is there anyway to add a color parameter to this function? I don't know where to start...I've never used color
:(

CornedBee
Mar 22nd, 2002, 12:28 PM
No, not directly. You can use SetTextColor to set the color of text, but you must do it every time you retrieve a DC (for controls, that are the WM_CTLCOLOR* messages)