MFC Ctreectrl [英] MFC Ctreectrl
问题描述
我需要带图像的ctreectrl
I need ctreectrl with images
在绘制或绘制treectrl的每个项目时我才会知道或者得到相应的图像。
while painting or drawing the treectrl's each item only I will come to know or get corresponding image.
我的树形控件有很多项目,所以我没有保存图像列表中的所有图像,所以我想获取图像,同时绘制或绘制treectrl的每个项目,并将绘制。
My tree control has many items so I am not saving all the image in imagelist so I want to get the image while painting or drawing the treectrl's each item only and will draw.
我是否必须覆盖onpaint()或 NM_CUSTOMDRAW
&
达到我的要求。
whether I have to override onpaint() or NM_CUSTOMDRAW
to
achieve my requirement.
推荐答案
使用NM_CUSTOMDRAW。覆盖OnPaint将非常困难,因为您需要处理树节点的所有各种状态。 CustomDraw更容易。 codeproject中有几个例子。
Use NM_CUSTOMDRAW. Overriding OnPaint is going to be very difficult as you'd need to handle all the various states of the tree nodes. CustomDraw is easier. There are several examples in codeproject.
这是一个开始。
https://www.codeproject.com/Articles/325/%2FArticles%2F325%2FA-custom-drawn-TreeList-Control
-Seetharam
-Seetharam
这篇关于MFC Ctreectrl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!