Files
VisionEdit/UsingControl/HZHControls/UIEditor/ImagePropertyEditor.cs
eggplantlwj 62477b8091 1、修复因加入输入位姿引发的BUG
2、PMA工具完善
3、其他BUG修复
2022-03-21 14:48:26 +08:00

39 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Linq;
using System.Text;
namespace HZH_Controls
{
public class ImagePropertyEditor : UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
{
//指定为模式窗体属性编辑器类型
return UITypeEditorEditStyle.Modal;
}
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
//打开属性编辑器修改数据
FrmSelectImage frm = new FrmSelectImage();
if (value == null || value is Image)
{
if (value != null)
frm.SelectImage = (Image)value;
if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
return frm.SelectImage;
else
return value;
}
else
{
throw new Exception("这不是一个FontIcons类型的属性");
}
}
}
}