using System; using System.ComponentModel; using System.Drawing.Design; using System.Windows.Forms; namespace CaeKnowledge.View { public class FileNameEditor : UITypeEditor { public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) { return UITypeEditorEditStyle.Modal; } public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { using (var dlg = new OpenFileDialog()) { dlg.FileName = value as string; if (dlg.ShowDialog() == DialogResult.OK) return dlg.FileName; } return value; } } }