// This code allows the designer to generate the Fill constructor

            public override object ConvertTo(ITypeDescriptorContext context,
                                             CultureInfo culture,
                                             object value,
                                             Type destinationType)
            {
                if (destinationType == typeof(string))
                {
                    // Display string in designer
                    return("(Filler)");
                }
                else if (destinationType == typeof(InstanceDescriptor) && value is Filler)
                {
                    Filler filler = (Filler)value;

                    if (filler.FillType == FillerType.Solid)
                    {
                        ConstructorInfo ctor = typeof(Filler).GetConstructor(new Type[] { typeof(Color) });
                        if (ctor != null)
                        {
                            return(new InstanceDescriptor(ctor, new object[] { filler.SolidColor }));
                        }
                    }
                    else if (filler.FillType == FillerType.Hatch)
                    {
                        ConstructorInfo ctor = typeof(Filler).GetConstructor(new Type[] { typeof(HatchStyle),
                                                                                          typeof(Color),
                                                                                          typeof(Color) });
                        if (ctor != null)
                        {
                            return(new InstanceDescriptor(ctor, new object[] { filler.HatchStyle,
                                                                               filler.HatchColor,
                                                                               filler.BackColor }));
                        }
                    }
                    else if (filler.FillType == FillerType.LinearGradient)
                    {
                        ConstructorInfo ctor = typeof(Filler).GetConstructor(new Type[] { typeof(float),
                                                                                          typeof(Color[]),
                                                                                          typeof(float[]) });
                        if (ctor != null)
                        {
                            return(new InstanceDescriptor(ctor, new object[] { filler.LinearGradientAngle,
                                                                               filler.GradientColors.Colors,
                                                                               filler.GradientColors.Positions }));
                        }
                    }
                    else if (filler.FillType == FillerType.PathGradient)
                    {
                        ConstructorInfo ctor = typeof(Filler).GetConstructor(new Type[] { typeof(PathGradientType),
                                                                                          typeof(Color[]),
                                                                                          typeof(float[]) });
                        if (ctor != null)
                        {
                            return(new InstanceDescriptor(ctor, new object[] { filler.PathGradientType,
                                                                               filler.GradientColors.Colors,
                                                                               filler.GradientColors.Positions }));
                        }
                    }
                    else
                    {
                        ConstructorInfo ctor = typeof(Filler).GetConstructor(Type.EmptyTypes);
                        if (ctor != null)
                        {
                            return(new InstanceDescriptor(ctor, null));
                        }
                    }
                }

                return(base.ConvertTo(context, culture, value, destinationType));
            }
 /// <summary>
 ///		Initializes a new instance of <c>FillerEditorDialog</c> using an empty <c>Filler</c>
 ///		and positioned beneath the specified control.
 /// </summary>
 /// <param name="c">Control beneath which the dialog should be placed.</param>
 public FillerEditorDialog(Control c) : this(Filler.Empty(), c)
 {
 }
 /// <summary>
 ///		Initializes a new instance of <c>FillerEditorDialog</c> using an existing <c>Filler</c>
 ///		and positioned beneath the specified control.
 /// </summary>
 /// <param name="filler">Existing <c>Filler</c> object.</param>
 /// <param name="c">Control beneath which the dialog should be placed.</param>
 /// <exception cref="System.ArgumentNullException">
 ///		Thrown if <paramref name="filler" /> is null.
 ///	</exception>
 public FillerEditorDialog(Filler filler, Control c) : this(filler)
 {
     Utils.SetStartPositionBelowControl(this, c);
 }
 /// <summary>
 ///		Initializes a new instance of <c>FillerEditorDialog</c> using an empty <c>Filler</c>
 ///     at the default window position.
 /// </summary>
 public FillerEditorDialog() : this(Filler.Empty())
 {
 }