Beispiel #1
0
 public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object Value, Type destinationType)
 {
     if (destinationType.Equals(typeof(InstanceDescriptor)))
     {
         ImageListBoxItemCollection items      = new ImageListBoxItemCollection();
         InstanceDescriptor         descriptor = new InstanceDescriptor(typeof(ImageListBoxItemCollection).GetConstructor(new Type[] { }), null, false);
         return(descriptor);
     }
     return(base.ConvertTo(context, culture, Value, destinationType));
 }
Beispiel #2
0
 public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object Value)
 {
     if (Value is InstanceDescriptor)
     {
         ImageListBoxItemCollection items      = new ImageListBoxItemCollection();
         InstanceDescriptor         descriptor = (InstanceDescriptor)Value;
         foreach (object obj in descriptor.Arguments)
         {
             if (obj is ImageListBoxItem)
             {
                 items.Add((ImageListBoxItem)obj);
             }
         }
         return(items);
     }
     return(base.ConvertFrom(context, culture, Value));
 }