TreeView字体大小 - 自定义绘制或所有者绘制 [英] TreeView fontsize - Custom Draw or Owner Draw

查看:267
本文介绍了TreeView字体大小 - 自定义绘制或所有者绘制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想改变一个TreeView控件的字体大小。在goolge搜索后,我只是得到一个想法,应该使用CustomDraw这个TreeView。但是 NMTVCUSTOMDRAW 结构只有 clrText clrText TreeView中显示的文本的前景和背景颜色。

我的问题是:

pre code> Q1:如何更改TreeView中的字体大小?对于TreeView的背景颜色
,可以使用TreeView_SetBkColor或发送消息。任何类似
的字体大小?

Q2:自定义绘制和所有者绘制有什么区别?


解决方案

你可以用 WM_SETFONT 消息来做到这一点。



Q2。他们做类似的事情。业主绘制是一个较旧的系统,意味着你必须自己绘制整个控制。自定义绘制更新更灵活,只要你喜欢就可以处理绘图的一部分(甚至不需要绘图,只需更改字体/颜色)。

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?

解决方案

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).

这篇关于TreeView字体大小 - 自定义绘制或所有者绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆