//============================================================ // <T>编辑属性内容。</T> // // @param context 类型描述器环境 // @param provider 服务提供对象 // @param value 属性内容 // @return 属性内容 //============================================================ public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if ((null != context) && (null != context.Instance) && (null != provider)) { IWindowsFormsEditorService editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService; if (null != editorService) { // 获得属性集合 FProperties properties = value as FProperties; if (properties == null) { throw new FFatalException("Properties is not exists."); } // 显示属性表单 context.OnComponentChanging(); // 编辑控件属性 QPropertiesEditorForm qForm = new QPropertiesEditorForm(); qForm.Properties = properties; if (editorService.ShowDialog(qForm) == DialogResult.OK) { context.OnComponentChanged(); return(properties); } } } return(base.EditValue(context, provider, value)); }
//============================================================ // <T>从指定类型转换为内容。</T> // // @param context 环境 // @param culture 文化 // @param value 内容 // @param destinationType 目标类型 // @return 是否含有位图 //============================================================ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { FProperties properties = new FProperties(); properties.Parse(value as string); return(properties); } return(null); }