using System;
using System.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms;
namespace GeoSigma.SigmaDrawerStyle
{
///
/// kev 数据来源选择框
///
public class PropertyEditorGriddingKevSource : UITypeEditor
{
private OpenFileDialog fileDialog = new OpenFileDialog();
///
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.DropDown;
}
///
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
fileDialog.FileName = value?.ToString();
fileDialog.Filter = "*.kev|*.kev|*.dfd|*.dfd";
if (fileDialog.ShowDialog() == DialogResult.OK)
{
return fileDialog.FileName;
}
return base.EditValue(context, provider, value);
}
}
}