Hello,

If I understood your problem correctly, you have a tree control and a bitmap is associated with each of its child item. When the user selects a child item, corresponding bitmap should be displayed in the dialog box. Is it not so?

You can use SetItemData and GetItemData member functions of CTreeCtrl or derived objects to store / retrieve the bitmap IDs.

Here is a sample code for storing the bitmaps as data of each item:

[CODE]HTREEITEM hItem;
m_Tree.SetItemData(hItem = m_Tree.InsertItem("1"), IDB_BITMAP1);
m_Tree.SetItemData(m_Tree.InsertItem("11", hItem), IDB_BITMAP2);
m_Tree.SetItemData(m_Tree.InsertItem("12", hItem), IDB_BITMAP3);
m_Tree.SetItemData(m_Tree.InsertItem("13", hItem), IDB_BITMAP4);
m_Tree.SetItemData(hItem = m_Tree.InsertItem("2"), IDB_BITMAP5);
m_Tree.SetItemData(m_Tree.InsertItem("21", hItem), IDB_BITMAP6);
m_Tree.SetItemData(m_Tree.InsertItem("22", hItem), IDB_BITMAP7);
/CODE]

In the event of TVN_SELCHANGED for the tree control, you can write the code to display the appropriate bitmap in the panel.

Code:
HTREEITEM hItem = m_Tree.GetSelectedItem();
if (hItem)
{
	CStatic* pPanel = (CStatic*) GetDlgItem(IDC_PANEL);
	UINT ID = m_Tree.GetItemData(hItem);
	CClientDC DC(pPanel);
	CDC MemDC;
	if (MemDC.CreateCompatibleDC(&DC))
	{
		CBitmap Bitmap;
		Bitmap.LoadBitmap(ID);
		BITMAP BM;
		Bitmap.GetBitmap(&BM);
		CBitmap* pBitmap = MemDC.SelectObject(&Bitmap);
		DC.BitBlt(0, 0, BM.bmWidth, BM.bmHeight, &MemDC, 0, 0, SRCCOPY);
		MemDC.SelectObject(pBitmap);
		Bitmap.DeleteObject();
		MemDC.DeleteDC();
	}
}
You will be able to view the bitmap associated with each item of the selection.

Regards,
Pravin.