如何将 MFC CFormView 放入 CDockablePane 中?
如何将 MFC CFormView 放入 VS 2008 MFC 功能包中引入的 CDockablePane 中?
How can I place a MFC CFormView inside a CDockablePane which was introduced in the VS 2008 MFC Feature Pack?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我在 MFC 功能包示例中找不到此类示例。
所有包含 CFormView 的项目都是:
TasksPane
选项卡控件
选项卡式视图
状态栏演示
设置窗格大小
MenuSubSet
但是在任何项目中,CFormView 都没有嵌入到 CDockablePane 中。
I couldn't find such samples in MFC Feature Pack samples.
All projects containing CFormView are :
TasksPane
TabControl
TabbedView
StatusBarDemo
SetPaneSize
MenuSubSet
But in any of the projects, CFormView is not embedded in CDockablePane.
有一个功能包示例可以执行此操作。
然而,我所做的如下:我创建了一个 CDialog 派生类,并将其放入 DockablePane 中。 然后,我创建一个 CFormView 派生类,并将其实例作为可停靠窗格的成员变量。 我感兴趣的每个函数(很可能是 UpdateView() 或其他任何名称),我都会转发到 CDialog 派生类。 这样我就可以避开将文档/视图结构硬塞到我的应用程序中的困难,并且仍然可以获得好处。
There is a sample of the feature pack that does this.
However, what I do is the following: I made a CDialog-derived class that I put in the DockablePane. Then I make a CFormView-derived class and make an instance of that a member variable of the dockable pane. Every function that I'm interested in (most likely UpdateView() or whatever it's called), I forward to the CDialog-derived class. That way I can sidestep the difficulties of shoehorning the doc/view structure into my application and still get the benefits.
实际上有几种方法可以做到这一点。
如果您派生自己的 CFameWnd 类,然后将该类的实例放入 CDockable 窗格中,您现在可以将所需的任何类型的框架放入该 CFrameWnd 派生类中。
诀窍是确保您按照正确的顺序进行创建。 如果你试图尽早调用它,那么你的内部视图将永远不会被创建。
Actually there are a few ways of doing this.
If you derive your own CFameWnd class and then put an instance of that class in the CDockable pane you now can put whatever type of framework that you want inside of that CFrameWnd derived class.
The trick is to make sure that you are doing the creation in the correct order. If you try to call it to early then your internal views will never be created.
也许这辆出租车是一个线索。
http://www.codeproject.com/KB/toolbars/sizecbar.aspx
虽然它不使用CDockablePane,但其背后的概念是相同的。
我还没有像页面中解释的那样尝试 CDockablePane 和 CFormView 的工作,但是看了一眼,我觉得事情很相似。
Probably this cab be a clue.
http://www.codeproject.com/KB/toolbars/sizecbar.aspx
Although it doesn't use CDockablePane, concept behind it is same.
I didn't try CDockablePane and CFormView work like the one explained in the page yet, but by taking a glance at it, I feel that things are similar.
检查 BCGSoft 示例以使用 cview 执行此操作。 类名略有不同,但或多或少是相同的,因为他们向 Microsoft 提供了 CDockablePane。
Check the BCGSoft Samples for doing this with a cview. The class names are a little different but its more or less the same stuff since they provided CDockablePane to Microsoft.