简体   繁体   English

MFC:使用CTreeCtrl和CToolbar创建一个类(CWnd?)

[英]MFC: Creating a class (CWnd?) with a CTreeCtrl and a CToolbar

I have a CDialog based application that has two side-by-side CTreeCtrl and both trees have nearly identical CToolbars above them. 我有一个基于CDialog的应用程序,它有两个并排的CTreeCtrl ,两个树上面都有几乎相同的CToolbars Currently, when the dialog receives a message from one of the toolbars, it passes the message to the appropriate tree. 目前,当对话框从其中一个工具栏收到消息时,它会将消息传递给相应的树。 I'd like to create a new class, probably derived from a CWnd, that contains one CTreeCtrl and one CToolbar . 我想创建一个新类,可能来自CWnd,它包含一个CTreeCtrl和一个CToolbar This new class would pass messages from its one toolbar to its one tree. 这个新类将消息从其一个工具栏传递到一个树。 It would remove a lot of redundant code (presumably) simplify ongoing development. 它将删除大量冗余代码(可能)简化正在进行的开发。

My question is, is CWnd the appropriate class for this task (to combine a CTreeCtrl and CToolbar )? 我的问题是, CWnd是否适合此任务的类(组合CTreeCtrlCToolbar )?

Thanks! 谢谢!

Yes, CWnd is the perfect container to encapsulate multiple controls. 是的, CWnd是封装多个控件的完美容器。 It was a bit of a challenge to register my class, but after that, the messaging worked great. 注册我的课程有点挑战,但在那之后,消息传递工作得很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM