C#不显示在打开文件对话框过滤器extenstions [英] C# Don't display filter extenstions in OpenFileDialog

查看:237
本文介绍了C#不显示在打开文件对话框过滤器extenstions的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在打开文件对话框的Filter属性多个扩展名。 ?

I have multiple extensions in the Filter property of OpenFileDialog. Is possible to hide the extensions and show only the description?

Sample:

样品$ C> dialog.Filter =图像文件| * .BMP; *。JPG;这里的许多图像文件的扩展名

dialog.Filter = "Image files|*.bmp;*.jpg; many image file extensions here"

我想只显示文字:图像文件,在文件类型组合框,因为扩展字符串很长。 ?这是可能的。

I want to show only the text: "Image files" in the file type combo box because the extension string is very long. Is this possible?

推荐答案

这应该工作:

    dialog.Filter = "All Supported Audio | *.mp3; *.wma | MP3s | *.mp3 | WMAs | *.wma";
    dialog.AutoUpgradeEnabled = false; //using FileDialog.AutoUpgradeEnabled = false it will display the old XP sytle dialog box, which then displays correctly
    dialog.ShowDialog();

这篇关于C#不显示在打开文件对话框过滤器extenstions的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆