📄 subject_28691.htm
字号:
<p>
序号:28691 发表者:木子 发表日期:2003-01-23 12:34:32
<br>主题:处理树形控件图标问题
<br>内容:在树形控件中,如何实现在第一层目录用第一个图标,第二层用第二个图标,第三层用第三个目录、、、、、、?
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:lin 回复日期:2003-01-23 12:58:04
<br>内容:何为在第一层目录用第一个图标,第二层用第二个图标,第三层用第三个目录、、、、、<BR><BR>看看这段代码可能对你有帮助:<BR>m_list.Create(16, 16, 0 ,8, 8);//CImageList m_list;(m_list为成员变量)<BR> m_list.Add(AfxGetApp()->LoadIcon(IDI_ICON1));<BR> m_list.Add(AfxGetApp()->LoadIcon(IDI_ICON2));<BR>m_list.Add(AfxGetApp()->LoadIcon(IDI_ICON3));<BR><BR> m_ctlTree.SetImageList(&m_list, TVSIL_NORMAL);<BR> <BR> TV_INSERTSTRUCT tvinsert;<BR> tvinsert.hParent = NULL;<BR> tvinsert.hInsertAfter = TVI_LAST;<BR> tvinsert.item.mask = TVIF_TEXT | TVIF_IMAGE;<BR> tvinsert.item.hItem = NULL;<BR> tvinsert.item.state = 0;<BR> tvinsert.item.stateMask = 0;<BR> tvinsert.item.cchTextMax = 6;<BR> tvinsert.item.cChildren = 0;<BR> tvinsert.item.lParam = 0;<BR><BR> //top level<BR> tvinsert.item.pszText = "Homer";<BR> tvinsert.item.iImage = 0;<BR> HTREEITEM hDad1 = m_ctlTree.InsertItem(&tvinsert);<BR> tvinsert.item.pszText = "Marge";<BR> HTREEITEM hDad2 = m_ctlTree.InsertItem(&tvinsert);<BR><BR> //second level<BR> tvinsert.hParent = hDad1;<BR> tvinsert.item.iImage = 1;<BR> tvinsert.item.pszText = "Homer";<BR> HTREEITEM hDad3 = m_ctlTree.InsertItem(&tvinsert);<BR> tvinsert.item.pszText = "Marge";<BR> m_ctlTree.InsertItem(&tvinsert);<BR><BR> //third level<BR> tvinsert.hParent = hDad3;<BR> tvinsert.item.iImage = 2;<BR> tvinsert.item.pszText = "Homer";<BR> HTREEITEM hDad4 = m_ctlTree.InsertItem(&tvinsert);<BR>添加内容前,制定图标索引(即再CImageList中的位置)
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:木子 回复日期:2003-01-23 13:12:38
<br>内容:非常感谢!!!!!!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -