Onega

a lot of VC++ posts, a few C# posts, and some miscellaneous stuff

Thursday, March 17, 2005

WM_SETFONT and WM_GETFONT change font of stat ic control in OnInitDialog

HFONT hfOld = (HFONT)::SendDlgItemMessage (this->m_hWnd,
IDS_SERVER_NAME, WM_GETFONT, 0, 0);
LOGFONT lf;
GetObject (hfOld, sizeof(lf), &lf);
lf.lfWeight = FW_BOLD;
HDC desktopdc = ::GetDC(::GetDesktopWindow());
lf.lfHeight = -MulDiv(7, GetDeviceCaps(desktopdc, LOGPIXELSY), 72);
DeleteDC(desktopdc);
::SendDlgItemMessage (this->m_hWnd, IDS_SERVER_NAME, WM_SETFONT,
(WPARAM)CreateFontIndirect (&lf), 0);

0 Comments:

Post a Comment

<< Home