[CTreeCtrl] adding different icons for internal and leaf nodes - Programmer

This is a discussion on [CTreeCtrl] adding different icons for internal and leaf nodes - Programmer ; Dear All, Has anybody done this with a CTreeCtrl? It is easy to use one icon, but how do I use two at the same time? Thanks -Thorsten...

+ Reply to Thread
Results 1 to 2 of 2

Thread: [CTreeCtrl] adding different icons for internal and leaf nodes

  1. [CTreeCtrl] adding different icons for internal and leaf nodes

    Dear All,

    Has anybody done this with a CTreeCtrl?

    It is easy to use one icon, but how do I use two at the same time?

    Thanks

    -Thorsten

  2. Re: [CTreeCtrl] adding different icons for internal and leaf nodes

    Thorsten Ottosen wrote:
    > Dear All,
    >
    > Has anybody done this with a CTreeCtrl?
    >
    > It is easy to use one icon, but how do I use two at the same time?


    For those who might read this thread in the future, I better
    show what I eventually came up with:

    icons_.Create( IDB_FAQ_BITMAP_CATEGORY, imageWidth, listSize,
    RGB(256,256,256) );
    mapArticle_.LoadMappedBitmap( IDB_FAQ_BITMAP_ARTICLE );
    mapArticle_.AssertValid();
    icons_.SetImageCount( listSize + 1 );
    icons_.Replace( 1, &mapArticle_, RGB(0,0,0) );
    icons_.AssertValid();

    faqTree_ = reinterpret_cast(
    this->GetDlgItem(IDC_FAQ_TREE) );
    faqTree_->SetImageList( &icons_, TVSIL_NORMAL );

    And I then call


    void TBuilderFaqTabDlg::setImage( HTREEITEM node, ImageIndex::Type r )
    {
    int image = r == ImageIndex::ARTICLE ? 1 : 0;
    faqTree_->SetItemImage( node, image, image );
    }

    to set the image for a node.

    best regards

    -Thorsten

+ Reply to Thread