在 CView 而不是 CMainFrame 中创建停靠窗格
当使用VS2008(加上功能包)的AppWizard创建“Visual Studio”风格的MDI应用程序时,CMainFrame
类获得一个方法CreateDockingWindows()
。
由于我不希望所有窗格始终可见,而是根据活动文档的类型显示它们,因此我将这些窗口设置为视图的成员,并将创建内容移至 OnInitialUpdate()
。 我以与 CMainFrame 相同的方式创建这些窗格,包括将主框架设置为父窗口。
停靠窗口的位置会自动保存到注册表中,但它们不会被恢复,因为在框架初始化时停靠窗口还不存在。
使用视图创建对接窗口是个好主意还是我应该期待更多问题? 有更好的方法来实现我想要的吗?
提前致谢!
When creating an MDI Application with "Visual Studio" style using the AppWizard of VS2008 (plus Feature Pack), the CMainFrame
class gets a method CreateDockingWindows()
.
Since I don't want all panes to be always visible but display them depending on the type of the active document, I made those windows to members of my views and also moved the creation to OnInitialUpdate()
. I create those panes in the same manner as was done by the CMainFrame
including setting the main frame as parent window.
The positions of the docking windows get saved to the registry automatically but they won't be restored because the docking windows don't yet exist when the frame is initialized.
Is it a good idea to create the docking windows with the views or should I expect more problems? Is there a better way to accomplish what I want?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,以下解决方案对我来说非常有效。
MainFrame 仍然拥有所有窗格,从而保留所有现有的框架功能。
我从实现我需要的“类似 CView”行为的类派生窗格:
The following solution turned out to work pretty well for me.
The MainFrame still owns all the panes thus keeping all the existing framework-functionality.
I derive the panes from a class which implements the "CView-like" behavior I need: