/// <summary> /// Open the editor form of property /// </summary> /// <param name="propertyName">Property name</param> /// <param name="value">PropertyValue</param> /// <returns>Value after configure</returns> public static object EditValue(string propertyName, PropertyClonableClass value) { PropertiesEditorForm form = new PropertiesEditorForm(); form.BindData(propertyName, value); form.ShowDialog(); return(form.GetValue()); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { //打开属性编辑器修改数据 Control control = context.Instance as Control; PropertyClonableClass data = context.PropertyDescriptor.GetValue(context.Instance) as PropertyClonableClass; // 强制变更,以将变更写入文件 PropertyDescriptor property = TypeDescriptor.GetProperties(control)["BackColor"]; property.SetValue(control, control.BackColor); return(PropertiesEditorForm.EditValue("SplitViewLayout", data)); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { //打开属性编辑器修改数据 Control control = context.Instance as Control; PropertyDescriptor editPropertyInfo = context.PropertyDescriptor; PropertyClonableClass data = editPropertyInfo.GetValue(context.Instance) as PropertyClonableClass; if (null == data) { throw new InvalidCastException("Property should be the subclass of PropertyClonableClass."); } // 强制变更,以将变更写入文件 PropertyDescriptor property = TypeDescriptor.GetProperties(control)["BackColor"]; property.SetValue(control, control.BackColor); return(PropertiesEditorForm.EditValue(editPropertyInfo.Name, data)); }