none
TreeView: text formatting and images of nodes.

    Question

  • Anyone out there today? I need some help with my treeview.

     

    First problem:

    cant figure out how to format my text in a node.

     

    I want do display childnodes with a name and some information. But I cant format the information so that the info of each childnode starts at the same place: Ex:

     

    Node1

           ChildnodePete                     informationPete

           Childnode1                     information1

           ChildnodeABCDEF                      informationABCDEF

     

    Is this possible to solve? The childnode name and information is the same string.

     

    Second problem:

    I want an image next to my nodes, but not my childnodes. But this seems impossible. Anyone have a solution to this?

     

    Third problem:

    I want my childnodes to be checkable but node the parent nodes. Is there a way to turn of the show checklistbox for the parent nodes and still leave it on for the childnodes???

     

    Many thanks in advance.

     

    /peter

     

     

    Wednesday, July 18, 2007 6:29 AM

Answers

  • You are asking too much of poor old TreeView.  Google for "TreeList".
    Wednesday, July 18, 2007 7:22 PM
    Moderator
  •  

    Hi Peter,

     

    You can draw your own TreeNde to display like what you want. To do this, you need to handle the TreeView.DrawNode event and set the DrawMode to OwnerDrawAll. This is a little bit complex. Check this acticle on MSDN for how to draw a TreeNode.

    However, using an extended TreeView will be much easier. Here is a project for you.

             http://www.codeproject.com/cs/miscctrl/treeviewadv.asp

     

    Hope this helps.

    Regards

    Thursday, July 19, 2007 12:35 PM

All replies

  • You are asking too much of poor old TreeView.  Google for "TreeList".
    Wednesday, July 18, 2007 7:22 PM
    Moderator
  •  

    Hi Peter,

     

    You can draw your own TreeNde to display like what you want. To do this, you need to handle the TreeView.DrawNode event and set the DrawMode to OwnerDrawAll. This is a little bit complex. Check this acticle on MSDN for how to draw a TreeNode.

    However, using an extended TreeView will be much easier. Here is a project for you.

             http://www.codeproject.com/cs/miscctrl/treeviewadv.asp

     

    Hope this helps.

    Regards

    Thursday, July 19, 2007 12:35 PM