简体   繁体   English

如何在Microsoft.Win32.OpenFileDialog()中多次过滤

[英]how to filter more than once in Microsoft.Win32.OpenFileDialog()

    Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.FileName = "Document"; // Default file name
dlg.DefaultExt = ".txt"; // Default file extension
dlg.Filter = "Text documents (.txt)|*.txt"; // Filter files by extension here

I want to filter more than one type 我想过滤不止一种类型

From http://msdn.microsoft.com/en-us/library/system.windows.forms.filedialog.filter.aspx : 来自http://msdn.microsoft.com/zh-cn/library/system.windows.forms.filedialog.filter.aspx

For each filtering option, the filter string contains a description of the filter, followed by the vertical bar (|) and the filter pattern. 对于每个过滤选项,过滤器字符串均包含过滤器的说明,后跟竖线(|)和过滤器图案。 The strings for different filtering options are separated by the vertical bar. 不同过滤选项的字符串由竖线分隔。

The following is an example of a filter string: 以下是过滤器字符串的示例:

Text files (*.txt)|*.txt|All files (*.*)|*.*

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM