嵌入文件打开对话框
Office 2010 有一种新型功能区,即 后台视图。这已在 MFC 中使用 Codejock Xtreme Toolkit Pro V15.0.1。
问题是我觉得 Office 中的“文件”>“打开”和“文件”>“另存为”行为非常奇怪。他们打开模式文件打开对话框,而不是在后台打开嵌入式文件打开对话框,这(恕我直言)感觉更自然。
我找不到使用 MFC 或 Win32 在 C++ 中执行此操作的方法。我唯一发现的是这个问题,但是那是德尔福的。
那么,是否可以将标准 Windows 文件打开对话框作为控件嵌入到另一个对话框中?还是我需要自己实施整个事情?
Office 2010 has a new type of ribbon, the backstage view. This has been implemented in MFC using Codejock Xtreme Toolkit Pro V15.0.1.
The thing is that I feel that the File>Open and File>SaveAs act very strange in Office. They open a modal file open dialog instead of opening an embedded file open dialog in the backstage, which would (IMHO) feel much more natural.
I cannot find a way of doing this in C++ using MFC or Win32. The only thing I found was this question, but that was for Delphi.
So, is it possible to embed the standard Windows File Open dialog as a control in another dialog? Or do I need to implement the entire thing myself?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,标准的“打开/保存”对话框功能仅通过模式对话框公开(通过 GetOpenFilename Win32 API)。
有一个标准机制可以自定义对话框(请参阅 Skizz 答案),但它仍然是一个模式对话框。高级自定义的一个案例是 VB6 打开项目 对话框:
现有
选项卡包含一个文件对话框。他们是怎么做到的?我的意思是,他们是如何设法将标准对话框放入其 3 选项卡属性表的页面中的?看来他们只是使用了标准自定义对话框,并在标准目录/文件控件上方添加了一个选项卡控件,并在目录/文件控件上方添加了其他“选项卡”的列表视图。当单击
Existing
以外的选项卡时,这些目录/文件控件会被自定义代码隐藏。你明白了:没有真正的标签!只是一个很好的旧文件对话框,其中主要控件可能被隐藏以支持其他控件。所以我的简短回答是:使用对话框作为子控件非常不走运。
现在,回到 Office:我认为最好保留模式对话框。否则会让用户感到困惑:我开始输入的路径是我刚刚单击“主页”并让保存命令未完成的真实路径吗?
To the best of my knowledge, The standard Open/Save dialog functionality is exposed through the modal dialog only (through the GetOpenFilename Win32 API).
There is a standard mechanisme to customise the dialog (See Skizz answer) but it remains a modal dialog. One case of advanced customisation was the VB6 Open Project dialog:
The
Existing
tab contains a file dialog. How did they do it? I mean, how did they manage to put a standard dialog into a page of their 3-tabs property sheet?It appears that they simply used the standard customization dialog and added a tab control above the standard dir/file controls and listview for other 'tabs' above dir/file controls. These dir/file controls were then hidden by the custom code when a tab other than
Existing
was clicked. You get it: no real tabs! Just a good old file dialog where the main controls may be hidden in favor of other ones.So my short answer is: You're pretty much out of luck using the dialog as a child control.
Now, to come back to Office: I believe it's better to keep a modal dialog. It would otherwise be confusing to user: Is the path that I started to type the real path of did I just clicked 'Home' and let the save command unfinished?
我不知道是否可以将文件打开对话框嵌入到另一个对话框中,但您当然可以扩展现有对话框:-
这是一种实现。
还有一个。
以及 MSDN 版本。
感谢大卫指出上面的内容有点过时了,所以,在快速谷歌之后,这里有一个 扩展文件对话框的更现代方式(还有很多其他的东西)。
I don't know if you can embed a file open dialog into another dialog, but you can certainly extend the existing dialogs:-
Here's one implementation.
And another.
And an MSDN version.
Thanks to David for pointing out the above are a bit out of date, so, after a quick Google, here's a more modern take on extending the file dialogs (and lots of other stuff as well).