CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2001
    Location
    Salzburg, Austria
    Posts
    126

    How to change the picture of TreeView when the node is expanded?

    Hi!
    Does anybody know how to change the picture of TreeView when the node is expanded? (I want to show one picture when the node is expanded and another one when the node is not)
    Thanks in advance.
    Jaime.


  2. #2
    Join Date
    Jul 2001
    Location
    Salzburg, Austria
    Posts
    126

    Re: How to change the picture of TreeView when the node is expanded?

    I have found it


    private Sub TreeView1_Expand(byval Node as MSComctlLib.Node)
    Node.Image = 2
    End Sub
    private Sub TreeView1_Collapse(byval Node as MSComctlLib.Node)
    Node.Image = 1
    End Sub



    Jaime


  3. #3
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: How to change the picture of TreeView when the node is expanded?

    You can use the ExpandedImage property of a node. this must be an index of an image in the associated imagelist (just like the image property).

    ' both "NORMAL" and "EXPANDED" must be images in the imagelist
    Dim N as Node
    set N = TreeView1.Nodes.Add Key:="ThisNode", Text:="Some Text"
    N.Picture = "NORMAL"
    N.ExpandedPicture = "EXPANDED"




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured