编程语言
首页 > 编程语言> > C#在OpenFileDialog中不显示过滤器扩展

C#在OpenFileDialog中不显示过滤器扩展

作者:互联网

我在OpenFileDialog的Filter属性中具有多个扩展名.是否可以隐藏扩展名并仅显示说明?

样品:

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

我只想在文件类型组合框中显示文本:“图像文件”,因为扩展名字符串很长.这可能吗?

解决方法:

这应该工作:

    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();

标签:openfiledialog,c
来源: https://codeday.me/bug/20191101/1986600.html