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 image set issue

CTreeCtrl image set issue

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestiongraphicsdata-structuresannouncement
1 Posts 1 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.
  • A Offline
    A Offline
    Abyss
    wrote on last edited by
    #1

    I have a CTreeCtrl object in my dialog, this control is initialized as follows:

    m_imgList.Create(16, 16, ILC_COLOR32, 1, 4);

    CBitmap bitmap;
    bitmap.LoadBitmap(IDB_BITMAP1);
    m_imgList.Add(&bitmap, RGB(0, 0, 0));
    bitmap.DeleteObject();

    bitmap.LoadBitmap(IDB_BITMAP2);
    m_nFolderImgNdx = m_imgList.Add(&bitmap, RGB(0, 0, 0));
    bitmap.DeleteObject();

    m_wndTree.SetImageList(&m_imgList, TVSIL_STATE);

    hNewItem = m_wndTree.InsertItem(
    TVIF_IMAGE | TVIF_PARAM | TVIF_STATE | TVIF_TEXT,
    _T(""), 1, -1, nState,
    TVIS_EXPANDED | TVIS_STATEIMAGEMASK,
    (LPARAM)pData, hItem, TVI_LAST);

    Later in the code I update each item of the tree control - text and image.

    m_wndTree.SetItemImage(hItem, 0, -1);

    However the tree control item does not update its image icon. It always display's its 1st image even I set the 0th image during the update. Any idea what is the problem :confused: ? Thanks, Abyss

    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