示例#1
0
            public override void ResetValue(object component)
            {
                WebDataEditorList fieldEditors = component as WebDataEditorList;

                if (fieldEditors != null)
                {
                    fieldEditors.ReSetEditorByName(Name);
                }
            }
示例#2
0
            public override void SetValue(object component, object value)
            {
                WebDataEditorList fieldEditors = component as WebDataEditorList;

                if (fieldEditors != null)
                {
                    fieldEditors.SetEditorByName(Name, (WebDataEditor)value);
                }
            }
示例#3
0
            public override object GetValue(object component)
            {
                WebDataEditorList fieldEditors = component as WebDataEditorList;

                if (fieldEditors != null)
                {
                    return(fieldEditors.GetEditorByName(Name));
                }
                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)
         {
             WebDataEditorList felst = context.Instance as WebDataEditorList;
             if (felst != null)
             {
                 DataEditorListBox list = new DataEditorListBox(edSvc);
                 edSvc.DropDownControl(list);
                 if (list.Selector != null)
                 {
                     WebDataEditor wd = list.Selector as WebDataEditor;
                     wd.SetHolder(felst.Holder);
                     if (list.Selector is WebDataEditorNone)
                     {
                         value = list.Selector;
                         felst.RemoveEditorByName(context.PropertyDescriptor.Name);
                     }
                     else
                     {
                         list.Selector.ValueField = context.PropertyDescriptor.Name;
                         list.Selector.SetFieldsAttribute(felst);
                         WebDataEditor          current = value as WebDataEditor;
                         DlgSetEditorAttributes dlg     = list.Selector.GetDataDialog(current);
                         if (dlg != null)
                         {
                             if (edSvc.ShowDialog(dlg) == DialogResult.OK)
                             {
                                 dlg.SelectedEditor.ValueField = context.PropertyDescriptor.Name;
                                 current = (WebDataEditor)dlg.SelectedEditor.Clone();
                                 value   = current;
                                 felst.AddEditor(current);
                             }
                         }
                         else
                         {
                             current = (WebDataEditor)list.Selector.Clone();
                             value   = list.Selector;
                             felst.AddEditor(current);
                         }
                     }
                     felst.Holder.OnEditorChanged(context.PropertyDescriptor.Name);
                 }
             }
         }
     }
     return(value);
 }
示例#5
0
 public override void PaintValue(PaintValueEventArgs e)
 {
     if (e.Context != null && e.Context.Instance != null && e.Context.PropertyDescriptor != null)
     {
         WebDataEditorList felst = e.Context.Instance as WebDataEditorList;
         if (felst != null)
         {
             WebDataEditor de = felst.GetEditorByName(e.Context.PropertyDescriptor.Name);
             if (de != null)
             {
                 e.Graphics.DrawImage(de.Icon, e.Bounds.Location);
             }
         }
     }
     base.PaintValue(e);
 }