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 / C++ / MFC
  4. CTreeCtrl item images without CImageList ?

CTreeCtrl item images without CImageList ?

Scheduled Pinned Locked Moved C / C++ / MFC
questiondatabasedata-structurestutorial
3 Posts 2 Posters 2 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.
  • M Offline
    M Offline
    Maximilien
    wrote on last edited by
    #1

    Main Question: Is it possible to set a tree item image (CTreeCtrl::SetItemImage) without having to build a CImageList ? I have to build different images corresponding to the items state and I would like to be able to create the image dynamically (lot of TransparentBlt) instead of having to list and build all the images and add them statically to the image list. i have a default item image and I TransparentBlt state images on it for example, an item can have the state1 enabled, and will display the appropriate image representing state1. an another item can have state1 and state4 and will display an image with the state1 and state4 Now, I have to create the imagelist for all combinations of states at compile time and call the SetItemImage with the image list index. I'd like to be able to simply call something like:

    myTree.SetItemImage( hItem, BuildMyItemImage(hItem ) ); // and that would dynamically build an image depending on the states and just use it.

    I'd rather be phishing!

    L 1 Reply Last reply
    0
    • M Maximilien

      Main Question: Is it possible to set a tree item image (CTreeCtrl::SetItemImage) without having to build a CImageList ? I have to build different images corresponding to the items state and I would like to be able to create the image dynamically (lot of TransparentBlt) instead of having to list and build all the images and add them statically to the image list. i have a default item image and I TransparentBlt state images on it for example, an item can have the state1 enabled, and will display the appropriate image representing state1. an another item can have state1 and state4 and will display an image with the state1 and state4 Now, I have to create the imagelist for all combinations of states at compile time and call the SetItemImage with the image list index. I'd like to be able to simply call something like:

      myTree.SetItemImage( hItem, BuildMyItemImage(hItem ) ); // and that would dynamically build an image depending on the states and just use it.

      I'd rather be phishing!

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

      Not according to CTreeCtrl Class | Microsoft Docs[^]. You could try adding your new image to the CImageList and using the new index value.

      M 1 Reply Last reply
      0
      • L Lost User

        Not according to CTreeCtrl Class | Microsoft Docs[^]. You could try adding your new image to the CImageList and using the new index value.

        M Offline
        M Offline
        Maximilien
        wrote on last edited by
        #3

        that's what I am doing; just annoying to have to create images for many combinations. Thanks.

        I'd rather be phishing!

        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