在.net自定义打开文件对话框自定义、对话框、文件、net

2023-09-04 00:20:46 作者:君子好逑。

在需要创建本地面色定制的.Net打开文件对话框在Windows XP和Windows Vista / 7。添加新的控制它,等有没有什么办法可以在.net中(WPF特别是)定制的标准打开文件对话框?我已经通过像 OpenFileDialogEx 的解决方案看,但所有的WINAPI挂钩的东西是不能接受的为了我。也许有人知道一个方法来提取,通过反射或一些本地对话框?如何在Windows Vista / 7本机打开文件对话框中实现?难道写在WPF?先谢谢了。

In need to create native looking customized .Net OpenFileDialog in Windows XP and Windows Vista/7. Add new controls to it, etc. Is there any way to customize standard OpenFileDialog in .Net (WPF specifically)? I've looked through the solutions like OpenFileDialogEx, but all that WINAPI hooking stuff is not acceptable for me. Maybe one knows a way to extract native dialogs via Reflection or something? How the native OpenFileDialog in Windows Vista/7 is implemented? Is it written in WPF? Thanks in advance.

问候,帕维尔。

推荐答案

习惯了它,因为那需要什么。打开文件对话框不是写在WPF中,对话框里面存在Windows作为非托管code。托管包装使用GetOpenFileName()的旧版本,目前那些在IFileOpenDialog COM接口。对于后者,所述IFileDialogCustomize接口被设计为自定义对话框

Get used to it because that what it takes. OpenFileDialog is not written in WPF, the dialog exists as unmanaged code inside Windows. The managed wrapper uses GetOpenFileName() on legacy versions, the IFileOpenDialog COM interface on current ones. For the latter one, the IFileDialogCustomize interface was designed to customize the dialog.

这些接口不仅容易从C ++程序,一个经典的祸害shell编程的使用。有支持XP系统的计算机是一个相当头疼的还有,实事求是您通过GetOpenFileName坚持与传统的对话()。这是什么code项目一样。

These interfaces are only easy to use from a C++ program, a classic scourge of shell programming. Having to support XP machines is a considerable headache as well, realistically you are stuck with the legacy dialog through GetOpenFileName(). Which is what that code project does.