C#在OpenFileDialog中不显示过滤器扩展 [英] C# Don't display filter extensions in OpenFileDialog

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

问题描述

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

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

示例:

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#在OpenFileDialog中不显示过滤器扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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