📄 subject_61120.htm
字号:
<p>
序号:61120 发表者:AJ 发表日期:2003-11-17 22:34:29
<br>主题:关于在视图中创建树目录的问题!!!!
<br>内容:void CAddressView::OnInitialUpdate()<BR>{<BR> CListView::OnInitialUpdate();<BR> CTreeView *pView;<BR> pView->GetTreeCtrl();<BR> CTreeCtrl &tc = GetTreeCtrl();<BR> m_ImageList.Create(16, 16, ILC_COLORDDB | ILC_MASK, 0, 1);<BR> <BR><BR> // load images and populate image list -GGH<BR><BR><BR> tc.SetImageList(&m_ImageList, TVSIL_NORMAL);<BR><BR> HTREEITEM hItem;<BR> hItem = tc.InsertItem("Classical", 0, 0);<BR> if (hItem)<BR> {<BR> tc.InsertItem("J. S. Bach", 0, 0, hItem);<BR> tc.InsertItem("W. A. Mozart", 0, 0, hItem);<BR> tc.InsertItem("F. Chopin", 0, 0, hItem);<BR> }<BR> // expand<BR> tc.Expand(hItem, TVE_EXPAND);<BR> <BR> hItem = tc.InsertItem("Jazz", 1, 1);<BR> if (hItem)<BR> {<BR> tc.InsertItem("Johnny Hodges", 1, 1, hItem);<BR> tc.InsertItem("Charlie Parker", 1, 1, hItem);<BR> tc.InsertItem("John Coltrane", 1, 1, hItem);<BR> }<BR> // expand<BR> tc.Expand(hItem, TVE_EXPAND);<BR><BR> // TODO: You may populate your ListView with items by directly accessing<BR> // its list control through a call to GetListCtrl().<BR>}<BR>---出错::<BR>--------------------Configuration: Address - Win32 Debug--------------------<BR>Compiling...<BR>AddressView.cpp<BR>H:\VC\study\Address\AddressView.cpp(68) : error C2065: 'GetTreeCtrl' : undeclared identifier<BR>H:\VC\study\Address\AddressView.cpp(68) : error C2440: 'initializing' : cannot convert from 'int' to 'class CTreeCtrl &'<BR> A reference that is not to 'const' cannot be bound to a non-lvalue<BR>Error executing cl.exe.<BR><BR>Address.exe - 2 error(s), 0 warning(s)<BR>而且树目录前面没有那个加号???GetTreeCtrl();要怎么声明呀???
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:浪际天涯 回复日期:2003-11-18 10:22:54
<br>内容:头文件:#include <afxcmn.h><BR>CTreeView *pView;<BR>pView->GetTreeCtrl();//pView此时指针为空,不能调用GetTreeCtrl();<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:AJ 回复日期:2003-11-18 11:34:56
<br>内容:CTreeCtrl &tc = GetTreeCtrl();是怎么加速!!!<BR>GetTreeCtrl();是怎么来的???
<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-11-18 11:48:36
<br>内容:CTreeView *pView = &GetTreeCtrl();<BR>HTREEITEM hItem = NULL;<BR>TV_INSERTSTRUCT tvinsert;<BR><BR>tvinsert.hParent = NULL;<BR>tvinsert.hInsertAfter = TVI_LAST;<BR>tvinsert.item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE |<BR> TVIF_TEXT;<BR>tvinsert.item.hItem = NULL; <BR>tvinsert.item.state = 0;<BR>tvinsert.item.stateMask = 1;<BR>tvinsert.item.cchTextMax = 128;<BR>tvinsert.item.iSelectedImage= 11;<BR>tvinsert.item.cChildren = 0;<BR>tvinsert.item.lParam = 0;<BR><BR>hIndItem = pView->InsertItem("str",ParentItem);
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:AJ 回复日期:2003-11-19 00:50:14
<br>内容:这是我做的!!!<BR>请问怎么样双击左边的树目录在右边的LIST视图中相应该的显?????????<BR>谢谢!!!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:AJ 回复日期:2003-11-19 00:52:09
<br>内容:这是我做的!!!<BR>请问怎么样双击左边的树目录在右边的LIST视图中相应该的显?????????<BR>谢谢!!!
<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-11-19 10:06:26
<br>内容:你要通过双击来选择吗?好像应该GetItemData()一下,取得相应的List中的值
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:浪际天涯 回复日期:2003-11-19 10:11:22
<br>内容:给你我的代码你看看
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:AJ 回复日期:2003-11-19 13:12:28
<br>内容:为什么我用向导新建一个CLeftView <BR>BaseClass是CTreeView会出错!!<BR>--------------------Configuration: Address - Win32 Debug--------------------<BR>Creating Type Library...<BR>Processing H:\VC\study\Address\Address.odl<BR>Address.odl<BR>Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\oaidl.idl<BR>oaidl.idl<BR>Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\objidl.idl<BR>objidl.idl<BR>Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\unknwn.idl<BR>unknwn.idl<BR>Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\wtypes.idl<BR>wtypes.idl<BR>Compiling...<BR>View3.cpp<BR>h:\vc\study\address\view3.h(14) : error C2504: 'CTreeView' : base class undefined<BR>H:\VC\study\Address\View3.cpp(17) : error C2440: 'return' : cannot convert from 'class CView3 *' to 'class CObject *'<BR> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<BR>H:\VC\study\Address\View3.cpp(17) : error C2653: 'CTreeView' : is not a class or namespace name<BR>H:\VC\study\Address\View3.cpp(17) : error C2065: 'classCTreeView' : undeclared identifier<BR>H:\VC\study\Address\View3.cpp(28) : error C2653: 'CTreeView' : is not a class or namespace name<BR>H:\VC\study\Address\View3.cpp(39) : error C2065: 'GetDocument' : undeclared identifier<BR>H:\VC\study\Address\View3.cpp(39) : error C2440: 'initializing' : cannot convert from 'int' to 'class CDocument *'<BR> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast<BR>H:\VC\study\Address\View3.cpp(49) : error C2653: 'CTreeView' : is not a class or namespace name<BR>H:\VC\study\Address\View3.cpp(54) : error C2653: 'CTreeView' : is not a class or namespace name<BR>Error executing cl.exe.<BR><BR>Address.exe - 9 error(s), 0 warning(s)
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:AJ 回复日期:2003-11-19 13:30:42
<br>内容:我知道了!!!<BR>要在stdafx.h文件上加上#include <afxcview.h>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:AJ 回复日期:2003-11-19 18:10:53
<br>内容:请问有谁看过我那段代码呀/???<BR>为什么右边的ListView不可以显示左边双击目录树选择的字符串???<BR>就是Joe下面的那的空的???急急呀????<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:AJ 回复日期:2003-11-20 09:17:22
<br>内容:大家来看看吧!!!!很想明白事!!+<BR>是不是在ListView中没有触发消息,所以双击左边的时候是传递了字符串,但在ListView中没有命令使它显示???????<BR>请大侠们看看吧!!!!
<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-11-20 09:39:01
<br>内容:m_cx是做什么用的?
<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-11-20 09:41:01
<br>内容:你想完成的是什么功能?
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:AJ 回复日期:2003-11-20 11:18:45
<br>内容:m_cx那个没有用的!!!<BR>我就是想双击左边的树在右边ListView显示!!!!<BR>谢谢oxjzhao!!!!!!!!!!!
<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-11-20 11:25:53
<br>内容:如何去显示呢?是增加到listView中,还是把原来的删除掉,显示点击的?<BR>我调试的时候看到你在InvalidateRect(rcClip,FALSE);句中,rcClip的坐标不对
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:AJ 回复日期:2003-11-20 21:44:40
<br>内容:那个可以不用管他了吧???<BR>就好像我双击Jazz,在右边的列表框里可以显示Jazz呀??????
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:AJ 回复日期:2003-11-25 00:00:21
<br>内容:有谁再帮我看看应该怎么办呀!!????好想死了!!!<BR><BR>VC好难呀!!
<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 + -