/// <summary>
 /// Gets or sets whether a given <see cref="PictureBoxStateProperties"/> is set in <see cref="AnimatedProperties"/>.
 /// </summary>
 public bool this[PictureBoxStateProperties property]
 {
     get { return(PictureBoxState.IsPropertySet(this.AnimatedProperties, property)); }
     set
     {
         if (value)
         {
             this.AnimatedProperties = this.AnimatedProperties | property;
         }
         else
         {
             this.AnimatedProperties = this.AnimatedProperties & ~property;
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// Converts a specified value (which must be a <see cref="PictureBoxState"/>) into a given
        /// type un the specified context.
        /// </summary>
        /// <param name="context">The formatting context.</param>
        /// <param name="info">The culture under which the conversion should be performed.</param>
        /// <param name="value">Value to convert.</param>
        /// <param name="destType">The type the conversion should result into.</param>
        /// <returns>The converted value.</returns>
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo info, object value, Type destType)
        {
            PictureBoxState state = (PictureBoxState)value;

            if (destType == typeof(InstanceDescriptor))
            {
                Type[] ctorTypes = new Type[] { typeof(byte), typeof(float), typeof(float), typeof(float),
                                                typeof(float), typeof(Color), typeof(Color), typeof(Color),
                                                typeof(Color), typeof(float), typeof(float), typeof(float),
                                                typeof(Point), typeof(Point), typeof(Point) };
                object[] ctorParams = new object[] { state.Alpha, state.RotationAngle, state.Zoom, state.ExtraImageRotationAngle,
                                                     state.BackColorGradientRotationAngle, state.BackColor, state.BackColor2, state.ForeColor,
                                                     state.TextHaloColor, state.TextHaloWidth, state.TextRotationAngle, state.TextZoom,
                                                     state.ShadowOffset, state.ImageOffset, state.TextOffset };
                return(new InstanceDescriptor(typeof(PictureBoxState).GetConstructor(ctorTypes), ctorParams, true));
            }

            return(base.ConvertTo(context, info, value, destType));
        }