Question

I need to at run time change the font of a List Control so as to used a fixed width font. I have seen some examples which suggest I should trap the NM_CUSTOMDRAW message, but I was wondering if there was a better way of doing it.

Thanks.

Was it helpful?

Solution

Create an appropriate CFont object, and set the control's font by calling SetFont(), passing in the CFont, like so:

m_font.CreatePointFont(90,"Courier New");
m_listCtrl.SetFont(&m_font);

This assumes that you've got a window or dialog object with a "CFont m_font" member, and an "m_listCtrl" member attached to the list control.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top