예제 #1
0
            public override void ResetValue(object component)
            {
                FieldEditorList fieldEditors = component as FieldEditorList;

                if (fieldEditors != null && fieldEditors.Fields != null)
                {
                    EPField fld = fieldEditors.Fields[Name];
                    if (fld != null)
                    {
                        fld.editor = null;
                    }
                }
            }
예제 #2
0
            public override void SetValue(object component, object value)
            {
                FieldEditorList fieldEditors = component as FieldEditorList;

                if (fieldEditors != null && fieldEditors.Fields != null)
                {
                    EPField fld = fieldEditors.Fields[Name];
                    if (fld != null)
                    {
                        fld.editor = (DataEditor)value;
                    }
                }
            }
예제 #3
0
            public override object GetValue(object component)
            {
                FieldEditorList fieldEditors = component as FieldEditorList;

                if (fieldEditors != null && fieldEditors.Fields != null)
                {
                    EPField fld = fieldEditors.Fields[Name];
                    if (fld != null)
                    {
                        return(fld.editor);
                    }
                }
                return(null);
            }
예제 #4
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (edSvc != null)
         {
             FieldEditorList felst = context.Instance as FieldEditorList;
             if (felst != null)
             {
                 DataEditorListBox list = new DataEditorListBox(edSvc);
                 edSvc.DropDownControl(list);
                 if (list.Selector != null)
                 {
                     if (list.Selector is DataEditorNone)
                     {
                         value = null;
                         felst.RemoveEditorByName(context.PropertyDescriptor.Name);
                     }
                     else
                     {
                         list.Selector.ValueField = context.PropertyDescriptor.Name;
                         list.Selector.SetFieldsAttribute(felst.Fields);
                         DataEditor             current = value as DataEditor;
                         DlgSetEditorAttributes dlg     = list.Selector.GetDataDialog(current);
                         if (dlg != null)
                         {
                             if (edSvc.ShowDialog(dlg) == DialogResult.OK)
                             {
                                 dlg.SelectedEditor.ValueField = context.PropertyDescriptor.Name;
                                 current = (DataEditor)dlg.SelectedEditor.Clone();
                                 value   = current;
                                 felst.AddEditor(current);
                             }
                         }
                         else
                         {
                             current = (DataEditor)list.Selector.Clone();
                             value   = list.Selector;
                             felst.AddEditor(current);
                         }
                     }
                 }
             }
         }
     }
     return(value);
 }
예제 #5
0
 public override void PaintValue(PaintValueEventArgs e)
 {
     if (e.Context != null && e.Context.Instance != null && e.Context.PropertyDescriptor != null)
     {
         FieldEditorList felst = e.Context.Instance as FieldEditorList;
         if (felst != null)
         {
             DataEditor de = felst.GetEditorByName(e.Context.PropertyDescriptor.Name);
             if (de != null)
             {
                 e.Graphics.DrawImage(de.Icon, e.Bounds.Location);
             }
         }
     }
     base.PaintValue(e);
 }