如何将 MFC CFormView 放入 CDockablePane 中?

发布于 2024-07-09 04:02:30 字数 64 浏览 8 评论 0原文

如何将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

捂风挽笑 2024-07-16 04:02:31

我在 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.

夏夜暖风 2024-07-16 04:02:31

有一个功能包示例可以执行此操作。

然而,我所做的如下:我创建了一个 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.

|煩躁 2024-07-16 04:02:31

实际上有几种方法可以做到这一点。

如果您派生自己的 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.

陌路终见情 2024-07-16 04:02:31

也许这辆出租车是一个线索。

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.

萌逼全场 2024-07-16 04:02:30

检查 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文