/// <summary> /// Construct a <see cref="GradientColor" /> from the properties in a <see cref="IDictionary" /> /// </summary> /// <param name="context">designer context</param> /// <param name="propertyValues">The "serialized" values for the <see cref="GradientColor" /></param> /// <returns>A <see cref="GradientColor" /></returns> public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues) { GradientColor gradientColor = new GradientColor(); gradientColor.Start = (System.Drawing.Color)propertyValues["Start"]; gradientColor.End = (System.Drawing.Color)propertyValues["End"]; return((object)gradientColor); }
/// <summary> /// Draw a preview of the <see cref="GradientColor" /> /// </summary> /// <param name="e">The paint event args providing the <see cref="Graphics" /> and bounding /// rectangle</param> public override void PaintValue(PaintValueEventArgs e) { GradientColor gradientColor = (GradientColor)e.Value; using (LinearGradientBrush b = gradientColor.GetBrush(e.Bounds, LinearGradientMode.Horizontal)) { e.Graphics.FillRectangle(b, e.Bounds); } }
/// <summary> /// Reset the property to its default value /// </summary> /// <remarks>Called by the IDE designer</remarks> protected void ResetPanelGradient() { PanelGradient = DefaultPanelGradient; }