SaveFileDialog 扩展名重叠
我想在我的 SaveFileDialog 中提供多个扩展。我想要以下扩展:
请参阅我发布的答案以获取解决方案。这是一个快速修复 - 也是一个相当愚蠢的错误。
SFD.Filter = "EXE (*.exe) |*.exe |JPEG (*.jpg)|*.jpg | MP3 (*.mp3)|*.mp3 | WAV (*.wav) |*.wav ";
使用上述过滤器,当更改文件类型时,扩展名将附加到文件名中。我希望文件扩展名能够相互替换。
切换文件类型后对话框文件名的示例:
OutputFile.exe .jpg .mp3 .wav
谢谢您的帮助,
Evan
I would like to offer multiple extensions in my SaveFileDialog. I would like to have the following extensions:
Please see my posted answer for the solution. It was a quick fix - and a fairly dumb mistake.
SFD.Filter = "EXE (*.exe) |*.exe |JPEG (*.jpg)|*.jpg | MP3 (*.mp3)|*.mp3 | WAV (*.wav) |*.wav ";
Using the above filter, when the file type is changed, the extension is appended to the filename. I would prefer that the file extensions replace one another.
An example of what the dialog filename might look like after switching file types:
OutputFile.exe .jpg .mp3 .wav
Thank you for any help,
Evan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果要将所有扩展合并到一个选择筛选器中,请尝试
作为参考,请查看 MSDN 页面的备注部分 FileDialog.Filter
If you want to combine all extensions to one selection filter, try
For reference, check out the remarks section of the MSDN page for FileDialog.Filter
我的原始代码的问题是“|”标记之间有空格。请看我下面的回答进行比较。
请注意其中没有空格。
谢谢你,
埃文
The issue with my original code is that I had spaces between the " | " marks. Please see my answer below for a comparison.
Notice how there are no spaces.
Thank you,
Evan