public static bool EditValue(IWin32Window owner, object component, string propertyName)
        {
            PropertyDescriptor prop = TypeDescriptor.GetProperties(component)[propertyName];

            if (prop == null)
            {
                throw new ArgumentException("PropertyName [" + propertyName + "] in object not found.");
            }
            UITypeEditor     editor = (UITypeEditor)prop.GetEditor(typeof(UITypeEditor));
            CollectionEditor ctx    = new CollectionEditor(owner, component, prop);

            if (editor != null && editor.GetEditStyle(ctx) == UITypeEditorEditStyle.Modal)
            {
                object value = prop.GetValue(component);
                value = editor.EditValue(ctx, ctx, value);
                if (!prop.IsReadOnly)
                {
                    prop.SetValue(component, value);
                    return(true);
                }
            }

            return(false);
        }
 //编辑字段
 private void EditField()
 {
     CollectionEditor.EditValue(this, m_NodeClass, "Fields");
 }
Esempio n. 3
0
 //编辑字段
 private void EditField()
 {
     CollectionEditor.EditValue(this, m_EditNodeDefine, "Fields");
 }