Namespace : Microsoft.Win32
Assembly : PresentationFramework.dll
download site : https://ko.dll-files.com/presentationframework.dll.html
attribute value : String
filter가 들어가 있는 string 값
exception : ArgumentException
code1 : empty/null
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = string.Empty;
dlg.ShowDialog();
code2 ( filter 1 )
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "Json File|*.json";
dlg.ShowDialog();
code3 ( filter n )
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "Office Files|*.doc;*.xls;*.ppt";
dlg.ShowDialog();
code 4 ( all file )
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "All Files|*.*";
dlg.ShowDialog();
code5 ( filter n )
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "Word Documents|*.doc|Excel Worksheets|*.xls|PowerPoint Presentations|*.ppt" +
"|Office Files|*.doc;*.xls;*.ppt" +
"|All Files|*.*";
dlg.ShowDialog();
표시되는 파일 형식의 하위 집합을 지정하려면 필터링할 하나 이상의 파일 형식을 지정하는 문자열 값(필터 문자열)으로 속성을 설정합니다Filter.
다음은 필터 문자열의 예상 형식을 보여줍니다.
FileType1[[|FileType2]...[|FileTypeN]]
다음 형식을 사용하여 각 파일 형식을 설명합니다.
Label|Extension1[[;Extension2]...[;ExtensionN]]
레이블 부분은 다음과 같이 파일 형식을 설명하는 사람이 읽을 수 있는 문자열 값입니다.
각 파일 형식은 하나 이상의 확장 명에서 설명해야 합니다.
둘 이상의 확장을 사용하는 경우 각 확장을 세미콜론(";")으로 구분해야 합니다.
"java file"|"*.jave"
"Json file"|"*.json"
"c file"|"*.c"
"c# file"|"*.cs"
"office file"|"*.doc;*.xls;*.ppt"
"모든 파일"|"*.*"
적용 대상
제품 버전
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7 Preview 4
참고 사이트 : https://docs.microsoft.com/ko-kr/dotnet/api/microsoft.win32.filedialog.filter?view=windowsdesktop-6.0