Groups | Blog | Home
all groups > vb.net controls > november 2005 >

vb.net controls : A TreeView with colored squares


pamelafluente NO[at]SPAM libero.it
11/1/2005 12:42:26 PM
I need to make a small treeview with just 3 nodes: "Red", "Green",
"Blue" Before each label (say, in place of or before the treenode icon)
I would like that a square appears (with same heigh of the treeview
item) filled with corresponding color.

Would anybody be so kind as to show me how to do it?

-Pamela
Atul
11/10/2005 12:00:00 AM
There is no direct way to do that in .Net way, so you have to do that using
p/invoke. Associate a state image list with the treeview using
the TVM_SETIMAGELIST. This state image list should have your colored square
bitmaps. Then fill a TVITEM structure for the tree node using the
TVM_GETITEM and then set the state field of the structure to an appropriate
value. See TVITEM structure help in MSDN.

----------------
-Atul, Sky Software http://www.ssware.com
Shell MegaPack For .Net & ActiveX
Windows Explorer GUI Controls
&
Quick-Launch Like Appbars, MSN/Office2003 Style Popups,
System Tray Icons and Shortcuts/Internet Shortcuts
----------------


[quoted text, click to view]

pamelafluente NO[at]SPAM libero.it
11/11/2005 3:03:04 PM

Atul ha scritto:

[quoted text, click to view]

Thank you Atul. I am sorry to hear that what seemed a simple task is
so hard to do
with VB.NET. I am afraid I do not have that pinvoke knowledge.

I hoped there was some kind of simple override mechanism which just
allowed to replace
the function which paints each treenode...

:-(

Thanks anyways

-Pamela




[quoted text, click to view]
AddThis Social Bookmark Button