is it possible to have dynamic labels for TreeNode?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I was wondering if it was at all possible to make the label of a TreeNode
dynamic- calling a specific method or property whenever it needs to obtain a
label to draw?

The reason is I'd like to have a number printed in the label, which
indicates how many children that node has (recursive)

so if this was a file system tree for example, I might have D:\ which has
the number 1,250 next to it (how many files in all of my D drive), then you
expand that and each folder in turn has a number showing how many files under
it, etc... down to every last folder.
 
Yes, but you have to code it yourself. Some examples to study:

Customizing a Control's Appearance Using Custom Draw
http://msdn.microsoft.com/library/d...ellcc/platform/commctls/custdraw/custdraw.asp,

SAMPLE: CustDTv Illustrates Custom Draw in a TreeView
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q248496

vbAccelerator TreeView Control
http://www.vbaccelerator.com/home/VB/Code/Controls/TreeView/TreeView_Control/article.asp

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
 
Back
Top