更改 SaveFileDialog 中“保存”和“取消”按钮的默认排列
我正在使用 c# 进行编码,我想更改 SaveFileDialog 中“保存”和“取消”按钮的默认排列。默认排列是“保存”按钮位于“取消”按钮上方。
我想要的是将“取消”按钮放在“保存”按钮的右侧。
我在网上搜索,发现这些按钮上的文本可以更改(答案在 stackoverflow 本身上),但没有发现任何更改其安排(位置)的信息。
如果到目前为止你们中有人经历过这个问题,请给我一个解决方案......
谢谢
I m coding in c# and I want to change the default arrangement of 'Save' and 'Cancel' buttons in SaveFileDialog. The default arrangement is that the 'Save' button is above the 'Cancel' button.
What I want is to place 'Cancel' button on the right hand side of the 'Save' button.
I searched over the web and found that the text on these buttons can be changed(to which the answer was on stackoverflow itself) and nothing found on changing their arrangements (locations).
Please give me a solution if any of you have experienced this so far....
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请不要这样做。
用户习惯了这些按钮出现的位置。如果你尝试改变它们的布局,那么你只会让你的应用程序感觉不对劲。
如果您必须这样做,那么应该确保您使用旧的文件对话框(这将使您的对话框在 Vista/7 上看起来更奇怪)。使用 OPENFILENAME 结构中的 lpfnHook 字段来获取对话过程的挂钩。响应 CDN_INITDONE 通知并使用 MoveWindow 或 SetWindowPos 移动按钮。您必须寻找按钮窗口句柄。
但实际上,请不要这样做,你只会让你的应用程序变得更糟。
Please don't do this.
The user is used to where these buttons appear. If you try to change their layout then you will just make you app feel wrong.
If you have to do this then should make sure you use the legacy file dialogs (which will make your dialogs look even more odd on Vista/7). Use the lpfnHook field in the
OPENFILENAME
struct to obtain hooks in to the dialog procedure. Respond to the CDN_INITDONE notification and move the buttons around with MoveWindow or SetWindowPos. You'll have to hunt for the button window handles.But really, please don't do this, you'll just make your app worse.
这敲响了警钟。当您拥有更改按钮文本的代码时,您就拥有了按钮窗口的句柄。然后,当您 pinvoke GetWindowRect 和 MoveWindow 将按钮移动到其他位置时,您可以使用它。请访问 pinvoke.net 查看声明。
请注意,该对话框在每个 Windows 版本中都发生了变化。下一个很可能会破坏你的程序。如果您不这样做,您的客户不会感到失望。
That rings a bell. When you have the code to change the text of the button then you have the handle of the button window. Which you can then use when you pinvoke GetWindowRect and MoveWindow to move the button somewhere else. Visit pinvoke.net for the declarations.
Beware that the dialog changed in every Windows version. The next one might well break your program. Your customer is not going to be disappointed when you don't do this.