Link to home
Start Free TrialLog in
Avatar of VapiSoft
VapiSoft

asked on

CListCtrl

Hi,
I am trying to change the font size in the Header of the a CListCtrl control.
I did as in the attached code but it did not work.
The font just became like a SYSTEM font.

CHeaderCtrl *header=list.GetHeaderCtrl( );
 HWND hwnd=header->GetSafeHwnd();
	HDC  hDC=::GetDC(hwnd);
	
	CFont font;
	LOGFONT lf;
	memset(&lf, 0, sizeof(LOGFONT));        zero out structure
	lf.lfHeight = 6;                       request a 12-pixel-height font
	strcpy(lf.lfFaceName, "Arial Narrow");         request a face name "Arial"
	VERIFY(font.CreateFontIndirect(&lf));   create the font
	
	header->SetFont( &font); 
	
	::SelectObject( hDC, (HFONT) font);
	::ReleaseDC(hwnd,hDC);

Open in new window

Avatar of alb66
alb66
Flag of Italy image

ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial