属性<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> | 描述 | 默认值 |
FileDialogType | Save or Open | FileDialogType.Save |
Filter | Filter string for file extensions | All Files (*.*)|*.* |
Title | Dialog box title | Select propertyname |
DefaultExtension | Default file extensions | None |
CheckFileExists | True to only allow selecting existing files | False |
CheckPathExists | True to only allow using existing paths | False |
在下面这段模版代码中,我们设置了弹出的对话框的类型为打开文件对话框,标题为“Select Input File”。
1
private
string
_openFileName
=
@"
c:\temp\test.txt
"
;
2 [Editor( typeof (FileNameEditor), typeof (System.Drawing.Design.UITypeEditor)),
3 FileDialogAttribute(FileDialogType.Open, Title = " Select Input File " ),
4 Category( " Custom " ), Description( " User selected file. " )]
5 public string OpenFileName
6 {
7 get {return _openFileName;}
8 set {_openFileName= value;}
9}
10
11 执行
12
2 [Editor( typeof (FileNameEditor), typeof (System.Drawing.Design.UITypeEditor)),
3 FileDialogAttribute(FileDialogType.Open, Title = " Select Input File " ),
4 Category( " Custom " ), Description( " User selected file. " )]
5 public string OpenFileName
6 {
7 get {return _openFileName;}
8 set {_openFileName= value;}
9}
10
11 执行
12
后弹出的对话框界面如下:
<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />