CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    14

    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.

  2. #2

    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.

  3. #3
    Join Date
    Apr 1999
    Posts
    14

    Re: How to change font in ListCtrl

    Gotcha.

    Best regards, Bob.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured