Results 1 to 5 of 5

Thread: Treeview Node Colors?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 1999
    Location
    Ikaalinen, Finland
    Posts
    26

    Question

    Hello!

    I've been wondering that is it possible to set a text color of a node in treeview list? I have a treeview in my project and I need to color some nodes with black and some with blue?

    Does anyone have a some kind of a code snippet about this?

    Thanks,
    - Ville

    [email protected]

    ......................
    Ville Mattila

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Location
    México, D.F.
    Posts
    84
    Hi Skyline:

    Yes it's posible to set a text color of a node.

    You can use some code like this:
    'Treeview1.Nodes([index node]).ForeColor = vbBlue'

    You can get the index number of a node in the 'NodeClick' event in the 'TreeView' object with:
    'MyNode = Node.Index', then use this 'MyNode' value in the [index node] and ready. Then you can create a procedure with a 'For Next' to select the nodes that you need to change the color or font.

    I hope this can help you.

    Regards.

    Angel Maldonado López.
    VB Programmer

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 1999
    Location
    Ikaalinen, Finland
    Posts
    26

    Unhappy

    Hello there!

    I'm sorry but it didn't help me. I tried the code:
    TreeView1.Nodes(0).ForeColor = vbBlue

    But I'll get an error "Method or data member not found" and text ".ForeColor = " was selected.

    I have VB5.0 Enterprise Edition.

    - Ville
    ......................
    Ville Mattila

  4. #4
    Lively Member
    Join Date
    Jan 1999
    Location
    México, D.F.
    Posts
    84
    Sorry Skyline...

    I thought that you were using Vb 6.0, for vb5 componentes you need to use API calls, maybe Aaron Young can help you he's an expert en API's.

    Sorry Again

    Regards.

    Angel Maldonado López.
    VB Programmer

  5. #5
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986

    VBAccelerator.com

    Hi there, take a look at http://www.VBAccelerator.com
    it has *many* cool controls/code/tips so take a look at the TreeView Component and don't forget to download the SSubtmr.DLL and any other neccesary components, but all of these are very small and at least smaller then the Common Controls.

    If you don't want to use this you can use the Common Controls 6. If you don't have it you can mail me, I got them from kedaman

    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

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