;
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CMFCtreeCtrlDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CMFCtreeCtrlDlg::initTreeCtrl()
{
m_ilNormal.Create(IDB_NORMAL,16,1,RGB(0,0,0));
m_tree.SetImageList(&m_ilNormal,LVSIL_NORMAL);
HTREEITEM hroot=m_tree.InsertItem("根文件夹",0,1);
HTREEITEM h1=m_tree.InsertItem("子文件夹1",0,1,hroot);
HTREEITEM h2=m_tree.InsertItem("子文件夹2",0,1,hroot);
HTREEITEM h3=m_tree.InsertItem("子文件夹3",0,1,hroot);
HTREEITEM h4=m_tree.InsertItem("子文件夹4",0,1,hroot);
HTREEITEM h2_1=m_tree.InsertItem("子文件夹2_1",0,1,h2);
HTREEITEM h2_1_1=m_tree.InsertItem("子文件夹2_1_1",0,1,h2_1);
m_tree.SetItemHeight(25);//高度
m_tree.Expand(hroot,TVE_EXPAND);//设置某个节点项的展开状态
}
【其他示例稍后补充】
|