我可以为TreeView控件设置Tranparent BackColor吗? [英] Can i set Tranparent BackColor For TreeView Control?
问题描述
大家好,
这是一个简单的问题.如何将TreeView控件的backColor设置为透明"颜色.
每次我都使颜色变透明.它向我显示一个错误,提示该控件不支持该颜色. >
任何反馈,请提供帮助. 谢谢.. 巴萨姆·巴萨马德(Bassam Basamad) 在这种情况下,您将不得不编写您自己的Treeview实现.创建一个新的customcontrol并从treeview继承.覆盖OnPaintBackground 现在在Windows窗体中实际上没有什么比透明的背景色更好.该框架在这里有一些技巧.如果将控件的背景设置为透明,它将继承其父控件的OnPaintBackground实现(不确定如何以代码方式实现),以模拟透明外观. 希望我能给您一个解决问题的方法.我认为您首先必须在这里和那里阅读有关如何处理OnPaintBackground的内容(如果它确实存在于树视图中;否则应为OnPaint) 也许此链接可以帮助您
Hi all,
it is simple question..How i can set the backColor of TreeView Control as Transparent color.
Each time i make transparent color..it show me an error that the control does not support that..how i can it support..that ?
any feedback,,please help..
thanks in advance..
Bassam Basamad
I that case you will have to write your own implementation of the treeview. Create a new customcontrol and inherit from treeview. override the OnPaintBackground
Now in windows forms there is actually nothing like transparent background color. The framework does a little trick here. If you set the background of a control to transparent it will inherit the OnPaintBackground implementation (am not really sure how this is done codewise) of its parent to simulate a transparent look.
Hope that I could give you an idea how to solve your problem. I think you will have to read first some here and there on how to handle the OnPaintBackground (if it actually exists for a treeview; otherwise the OnPaint)
Maybe this link can help you out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconrenderingwindowsformscontrol.asp
这篇关于我可以为TreeView控件设置Tranparent BackColor吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!