You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kev/Drawer/UCDraw/SigmaDrawerStyle/PropertyEditorGriddingKevSo...

36 lines
1014 B
C#

1 month ago
using System;
using System.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms;
namespace GeoSigma.SigmaDrawerStyle
{
/// <summary>
/// kev 数据来源选择框
/// </summary>
public class PropertyEditorGriddingKevSource : UITypeEditor
{
private OpenFileDialog fileDialog = new OpenFileDialog();
/// <inheritdoc/>
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.DropDown;
}
/// <inheritdoc/>
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);
}
}
}