Files
VisionEdit/UsingControl/HZHControls/UIEditor/ImagePropertyEditor.cs
liu.wenjie a24dda2525 1、优化LOG显示与引用
2、添加PMA工具,工具内容待完善
3、修复流程树显示
4、添加开源项目,优化UI空间
5、其他BUG更改
2021-11-23 15:51:37 +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类型的属性");
}
}
}
}