Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Image on specific tree node

Image on specific tree node

Scheduled Pinned Locked Moved C#
questiondata-structures
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KaurGurpreet
    wrote on last edited by
    #1

    In the treeview, I want to display an image only on few nodes (not all). How do I do this?

    Gurpreet

    L 1 Reply Last reply
    0
    • K KaurGurpreet

      In the treeview, I want to display an image only on few nodes (not all). How do I do this?

      Gurpreet

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      use treeNode.ImageIndex property. http://msdn.microsoft.com/en-us/library/system.windows.forms.treenode.imageindex.aspx[^]

      K 1 Reply Last reply
      0
      • L Lost User

        use treeNode.ImageIndex property. http://msdn.microsoft.com/en-us/library/system.windows.forms.treenode.imageindex.aspx[^]

        K Offline
        K Offline
        KaurGurpreet
        wrote on last edited by
        #3

        I am looking for showing image only on specific node. That does not work in this way. It shows image for all nodes or none.

        Gurpreet

        M P 2 Replies Last reply
        0
        • K KaurGurpreet

          I am looking for showing image only on specific node. That does not work in this way. It shows image for all nodes or none.

          Gurpreet

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          You can set the image index on individual nodes. Node.ImageIndex

          Never underestimate the power of human stupidity RAH

          1 Reply Last reply
          0
          • K KaurGurpreet

            I am looking for showing image only on specific node. That does not work in this way. It shows image for all nodes or none.

            Gurpreet

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            You need to set the ImageIndex (and optionally, the SelectedImageIndex) on the TreeNode you are interested in changing. If you only want to display an image on this node, you effectively have 2 choices - one is to add a dummy transparent image as the default image for the other nodes; the other is to change the ImageIndex/SelectedImageIndex for the ones you don't want.

            "WPF has many lovers. It's a veritable porn star!" - Josh Smith

            As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

            My blog | My articles | MoXAML PowerToys | Onyx

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups