Draw text gradient list visible in property grid

This commit is contained in:
Jaex 2014-08-04 03:49:24 +03:00
parent ddfa41391f
commit 535332393f
3 changed files with 7 additions and 8 deletions

View file

@ -126,11 +126,10 @@ public int CornerRadius
[DefaultValue(typeof(Color), "0, 20, 40"), Editor(typeof(MyColorEditor), typeof(UITypeEditor)), TypeConverter(typeof(MyColorConverter))] [DefaultValue(typeof(Color), "0, 20, 40"), Editor(typeof(MyColorEditor), typeof(UITypeEditor)), TypeConverter(typeof(MyColorConverter))]
public Color BackgroundColor2 { get; set; } public Color BackgroundColor2 { get; set; }
[Browsable(false), DefaultValue(false)] [DefaultValue(false)]
public bool UseCustomGradient { get; set; } public bool UseCustomGradient { get; set; }
// Need custom editor // TODO: Need custom editor
[Browsable(false)]
public List<GradientStop> CustomGradientList { get; set; } public List<GradientStop> CustomGradientList { get; set; }
[DefaultValue(LinearGradientMode.Vertical)] [DefaultValue(LinearGradientMode.Vertical)]
@ -139,6 +138,7 @@ public int CornerRadius
public DrawText() public DrawText()
{ {
this.ApplyDefaultPropertyValues(); this.ApplyDefaultPropertyValues();
CustomGradientList = new List<GradientStop>();
} }
public override Image Apply(Image img) public override Image Apply(Image img)

View file

@ -26,12 +26,13 @@
using HelpersLib; using HelpersLib;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Drawing.Design;
namespace ImageEffectsLib namespace ImageEffectsLib
{ {
public class GradientStop public class GradientStop
{ {
[DefaultValue(typeof(Color), "Black")] [DefaultValue(typeof(Color), "Black"), Editor(typeof(MyColorEditor), typeof(UITypeEditor)), TypeConverter(typeof(MyColorConverter))]
public Color Color { get; set; } public Color Color { get; set; }
private float offset; private float offset;
@ -45,10 +46,7 @@ public float Offset
} }
set set
{ {
if (value >= 0 || value <= 1) offset = value.Between(0, 1);
{
offset = value;
}
} }
} }

View file

@ -216,6 +216,7 @@ private void InitializeComponent()
// //
// eiImageEffects // eiImageEffects
// //
this.eiImageEffects.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.eiImageEffects.Location = new System.Drawing.Point(8, 734); this.eiImageEffects.Location = new System.Drawing.Point(8, 734);
this.eiImageEffects.Name = "eiImageEffects"; this.eiImageEffects.Name = "eiImageEffects";
this.eiImageEffects.ObjectType = null; this.eiImageEffects.ObjectType = null;