How to change font in ListCtrl
Hi!
I have code:
CFont Font;
if( Font.CreateFont( 20, //int nHeight,
30, //int nWidth,
0, //int nEscapement,
0, //int nOrientation,
0, //int nWeight,
1, //BYTE bItalic,
0, //BYTE bUnderline,
0, //BYTE cStrikeOut,
1, // BYTE nCharSet,
OUT_DEFAULT_PRECIS, //BYTE nOutPrecision,
CLIP_DEFAULT_PRECIS, //BYTE nClipPrecision,
DEFAULT_QUALITY, //BYTE nQuality,
VARIABLE_PITCH | TMPF_TRUETYPE, //BYTE nPitchAndFamily,
"Arial" //LPCTSTR lpszFacename
))
m_Table.SetFont( &Font, true );
This code does not change font (and size). What is wrong?
I know it is simple. Help, please.
Best regards, Bob.
Re: How to change font in ListCtrl
The CFont object must live as long as the CListCtrl object does. This means, the CFont must be a member of the same class the CListCtrl is, or be a (ugh) global variable, or be (ugh) a static variable within a function.
Make the CFont a member of the class and that should fix it.
LA Leonard - Definitive Solutions, Inc.
Re: How to change font in ListCtrl
Gotcha.
Best regards, Bob.