Programming 版 (精华区)
发信人: www (天凉好个秋), 信区: Programming
标 题: Re: 怎样使用CTreeview类?
发信站: 紫丁香 (Mon Sep 22 19:19:05 1997)
There are some examples in the CD of VC++4.0 :
one is Cmnctrls(in directory mfc-->general)
the other is Daoview(in directory mfc-->Database)
You can take them as your reference.
Here is a part from my program:(just for your understanding)
CMainFrame* pWnd=(CMainFrame*)AfxGetMainWnd();
TV_INSERTSTRUCT TreeCtrlItem;
TreeCtrlItem.hInsertAfter = TVI_LAST;
TreeCtrlItem.item.mask = TVIF_TEXT;
int ctable=pWnd->url_bookmarks.GetSize();
char sline[255];
int i;
CString stp="BookMarks";
TreeCtrlItem.hParent = TVI_ROOT;
strcpy(sline,stp);
TreeCtrlItem.item.pszText =sline;
HTREEITEM hTreeItem1=m_tree.InsertItem(&TreeCtrlItem);
//here m_tree is a class of CTreeView;
TreeCtrlItem.hParent = hTreeItem1;
for(i=0;i<ctable;i++)
{
stp=pWnd->url_bookmarks.GetAt(i);
strcpy(sline,stp);
TreeCtrlItem.item.pszText=sline;
HTREEITEM hTreeItem2=m_tree.InsertItem(&TreeCtrlItem);
}
m_tree.Expand(hTreeItem1,TVE_EXPAND);
【 在 fine (遨游四方) 的大作中提到: 】
: 如题.
鴛
--
※ 来源:.紫丁香 pclinux.hit.edu.cn.[FROM: 202.118.228.89]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.328毫秒