TreeView fontsize - Custom Draw or Owner Draw

2019-08-10 08:30发布

问题:

I want to change the font size of a TreeView control. After searching on goolge, I just get some idea that one should use CustomDraw for this TreeView. But NMTVCUSTOMDRAW structure only has clrText and clrText which set the foreground and background color of the displayed texts in TreeView.

My questions are:

Q1: How to change the font size in a TreeView? For the background color of TreeView,
    one can just use `TreeView_SetBkColor` or send a message. Anything similar
    for font size?

Q2: What's the difference between Custom Draw and Owner Draw?

回答1:

Q1. You can do this with the WM_SETFONT message.

Q2. They do similar things. Owner draw is an older system and means you have to draw the entire control yourself. Custom draw is newer and more flexible, letting you handle just parts of the drawing if you like (or even no drawing, and just changing fonts/colors).