[英]MFC: How can we switch from CTreeCtrl to CTreeView easly?
I have an graphics MFC application which historically was developed by using a CTreeCtrl
.我有一个图形 MFC 应用程序,它在历史上是使用
CTreeCtrl
开发的。
I want to add a CSplitterWnd
to improve its graphical interface.我想添加一个
CSplitterWnd
来改进它的图形界面。 However, I found that the CTreeCtrl is not compatible with CSplitterWnd.但是,我发现 CTreeCtrl 与 CSplitterWnd 不兼容。 Apparently i must use a
CTreeView
.显然我必须使用
CTreeView
。
CSplitterWnd m_wndSplitter;
// Runtime error on CreateView
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(myCTreeCtrl),CSize(100,100),pContext))
My problem:我的问题:
If I switch to CTreeView
, i must develop a lot of functions (example: SelectItem)如果我切换到
CTreeView
,我必须开发很多功能(例如:SelectItem)
Question:题:
How can I switch easly from CTreeCtrl
to CTreeView
?如何轻松地从
CTreeCtrl
切换到CTreeView
? or can I for example insert a ctreectrl
in a CFormview
which will be used instead of CtreeView
?或者我可以在
CFormview
中插入一个ctreectrl
来代替CtreeView
吗?
The CTreeView
class has member function CTreeCtrl& GetTreeCtrl() const
. CTreeView
class 有成员 function CTreeCtrl& GetTreeCtrl() const
。 Replace all occurrences of替换所有出现的
SelectItem(foo);
by经过
GetTreeCtrl().SelectItem(foo);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.