In MFC how to display the CListctrl's header text in bold?

abc abc 351 Reputation points
2022-04-12T08:46:01.45+00:00

Hi,

In MFC how to display the CListctrl's header text in bold?

Thanks in advance.

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,636 questions
0 comments No comments
{count} votes

Accepted answer
  1. David Lowndes 4,711 Reputation points
    2022-04-12T09:21:53.943+00:00

    When the list control has been created (you can usually do this in a dialog's OnInitDialog handler), use GetHeaderCtrl to get access to the list control's header window.

    If you want to just bold the existing font, use GetFont & GetLogFont, set the bold style, create a new font from the LOGFONT using CreateFontIndirect and save the newly created font object in the list control's parent class (usually a dialog class) so that the font will exist for the lifetime of the list control.

    Set the header control's font to your new font using SetFont.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful