Treeview(Win32 API)背景色需要帮助 [英] Treeview (win32 api ) background color need help

查看:86
本文介绍了Treeview(Win32 API)背景色需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的程序中,我想让一个树形视图具有不同的背景色.占据奇数行的项目具有背景色,占据偶数行的项目具有不同的背景色.当我使用自定义绘制初始化树形视图时,这可以完成.但是当树状视图被展开或折叠时,出现了问题.展开的项目旁边的兄弟项目,如果它更改了奇数行或偶数行,则不会更改背景颜色.因为系统不会重新绘制

In my program, I want to make a treeview has different background color.Item that occupy the odd line has a background color, occupy the even line has a different background color.When I init the treeview using the custom draw, this can be done.But when the treeview is expanded or collapsed, problems happened.Sibling item next the expanded item,won''t change the background color if it changes the odd line or even line.Because the system won''t repaint the item.Can I use some ways to solve the problem?

推荐答案

尝试
Try Invalidating[^] it. Set the 2nd parameter, lpRect, to NULL. This will make the whole control repaint. Assuming your code for setting the line colour is correct, this will work.
Probably no need to erase, but see what works with that last parameter


这篇关于Treeview(Win32 API)背景色需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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