Re: don't want to show images for treeview child items



Hi AliR ,

I tried use -1 as shown below. But the two child items (bolt 1 & 2) still
use their parents' image. If I uncomment hRoot and place "Yes" and "No"
items below hRoot, the problem disappears. But I don't want the extra hRoot
item. Your further help is much appreciated. JD

BOOL CBoltsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_imgList.Create(IDB_BITMAP_BOLTS, 16, 2, RGB(255, 0, 255));
m_treeCtrl.SetImageList(&m_imgList, TVSIL_NORMAL);

//HTREEITEM hRoot = m_treeCtrl.InsertItem(_T(""));
HTREEITEM hNo = m_treeCtrl.InsertItem(_T("Yes"), 0, 0, TVI_ROOT); //,
hRoot);
m_treeCtrl.InsertItem(_T("Bolt 1"), -1, -1, hNo);
HTREEITEM hYes = m_treeCtrl.InsertItem(_T("No"), 1, 1, TVI_ROOT); //,
hRoot);
m_treeCtrl.InsertItem(_T("Bolt 2"), -1, -1, hYes);
...................

JD

"AliR (VC++ MVP)" <AliR@xxxxxxxxxxxxx> wrote in message
news:CSBIi.10112$z_5.334@xxxxxxxxxxxxxxxxxxxxxxx
I don't about child items inheriting images from the parent.

But when you add your child items pass a -1 to InsertItem as the Image
index.

AliR.


"JD" <jdt_young@xxxxxxxxx> wrote in message
news:uwvPga8%23HHA.5404@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

I set up a tree view control. I see all of the child items inherit their
images from their parents. But for some child items, I don't want to
show any image at all. How do I kill the inheritance? Your help is
appreciated.

JD




.


Loading