如何将 CPaneDialog 停靠到 MainFrm 并..?
我的 CPaneDialog 有问题。 我使用 SetPaneSize MFC 功能包示例项目进行了测试。奇怪的是 CPaneDialog 不能停靠到 MainFrm,而 CDockablePane 可以。 CPaneDialog 也是 CDockablePane 的子类,但事实并非如此。 只有 DockToWindow( &other_CPaneDialog_instance... ) 是可能的。 如果我调用 DockToPane(),CPaneDialog 的内容不会正确绘制或刷新。
如何将 CPaneDialog 停靠到 MainFrm 窗口?
另一个问题是关于绘图。如果删除 SetPaneSize 示例中树控件的代码,则 view1(CDockablePane 的实例)的内容不会正确重绘。 经过一些实验后,我决定应该在其 OnSize 和 OnPaint 方法中做一些事情。 (OnSize 更为关键。)这是预期的行为吗?
I have problem with CPaneDialog.
I tested with SetPaneSize MFC feature pack sample projects. What is weird is that CPaneDialog can't be docked to MainFrm while CDockablePane can be. The CPaneDialog is also a child class of the CDockablePane, but it can't be.
Only DockToWindow( &other_CPaneDialog_instance... ) is possible.
If I call DockToPane(), the content of the CPaneDialog is not drawn or refreshed correctly.
How can a CPaneDialog be docked to MainFrm window?
Another problem is about drawing. If remove codes for tree control in the SetPaneSize sample, the content of the view1 ( an instance of CDockablePane) is not redrawn properly.
After doing some experiment, I decided that something should be done in its OnSize and OnPaint method. (OnSize is more critical. ) Is this expected behaviour?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在转换较旧的 MFC 应用程序时,我遇到了与功能包类似的问题。我没有时间正确解决它,但我使用了以下解决方法:
还有两件事:
这可以确保对话框的大小正确并防止用户拖动栏。
HTH,这对我有用。
While converting an older MFC-application I ran into similar problems with the feature pack. I didn't have the time to solve it correctly, but I used following workaround:
2 more things:
This assures proper sizing of the dialog and preventing the user from dragging the bar around.
HTH, it worked for me.
将 HexEdit 转换为 MFC9(请参阅 http://www.hexedit.com)我遇到了这个问题。我在VS2010(MFC10)中测试过,这个bug似乎已经被修复了。
另请注意,这个问题并不是主要问题,因为您可以在 CMainFrame::OnCreate 中使用 DockToWindow 来停靠到 CDockablePane(如果有的话)。用户可以浮动窗口或将其停靠在其他位置,重新打开程序时将记住并恢复该位置。
我很确定有人对 MFC9 中的这个错误不熟悉 - 因此 SetPaneSize 演示中的明显解决方法(调用 CDockablePane::DockToWindow 而不是用于所有其他可停靠窗口的 DockPane)。但至少在MFC10中是固定的。
我发现的另一个错误是,如果 CPaneDialog 在关闭(隐藏)时浮动,那么当您重新启动应用程序时,窗格将重新打开,而不是恢复到正确(隐藏)状态。如果窗格在关闭时停靠,则不会发生这种情况。 MFC10 中也已修复此问题。
Converting HexEdit to MFC9 (see http://www.hexedit.com) I ran into this problem. I tested in VS2010 (MFC10) and this bug appears to have been fixed.
Also note that this problem is not a major thing as you can just use DockToWindow in CMainFrame::OnCreate to dock to a CDockablePane (if you have one). The user can float the window or dock it elsewhere and the position will be remembered and restored when the program is re-opened.
I am pretty sure someone new about this bug in MFC9 - hence the obvious workaround in the SetPaneSize demo (calling CDockablePane::DockToWindow rather than DockPane as was used for all the other dockable windows). But at least it is fixed in MFC10.
Another bug I found is that if a CPaneDialog is floating when closed (hidden), then when you restart the application the pane is reopened, rather than being restored in the correct (hidden) state. This does not occur if the pane is docked when closed. This has also been fixed in MFC10.