0

我在 VC++ 中创建了一个树控件,但我无法选择子节点。有什么建议么?

m_pTree->Create(WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP |
                 TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT |
                 TVS_SINGLEEXPAND | TVS_SHOWSELALWAYS | 
         TVS_TRACKSELECT,CRect(10, 10, 200, 240), this, 0x1221);

hTree=m_pTree->InsertItem(_T("SoftWare Production") , TVI_ROOT);
hCompany=m_pTree->InsertItem(_T("Microsoft"),hTree);
m_pTree->InsertItem(_T("Office") , hCompany);
m_pTree->InsertItem(_T("Visual Studio") , hCompany);
m_pTree->InsertItem(_T("Servers") ,hCompany , TVI_LAST);

m_pTree->Expand(hCompany, TVE_EXPAND);

hCompany=m_pTree->InsertItem(_T("Linux"),hTree);
m_pTree->InsertItem(_T("Open Office") , hCompany);
m_pTree->InsertItem(_T("QMail") , hCompany);
m_pTree->InsertItem(_T("Apache") ,hCompany,TVI_LAST);



m_pTree->Expand(hCompany, TVE_EXPAND);
4

1 回答 1

1

我认为 m_pTree->SelectItem(HTREEITEM) 应该工作

于 2012-07-13T09:16:33.150 回答