/// <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()) { }
// This code allows the designer to generate the Fill constructor /// <summary> /// Converts the given value object to the specified type, using the specified context and culture information. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.</param> /// <param name="culture">A <see cref="T:System.Globalization.CultureInfo" />. If null is passed, the current culture is assumed.</param> /// <param name="value">The <see cref="T:System.Object" /> to convert.</param> /// <param name="destinationType">The <see cref="T:System.Type" /> to convert the <paramref name="value" /> parameter to.</param> /// <returns>An <see cref="T:System.Object" /> that represents the converted value.</returns> public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (value is Filler) { if (destinationType == typeof(string)) { // Display string in designer return("(Filler)"); } else if (destinationType == typeof(InstanceDescriptor)) { 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)); }