NLinearGradientFill GradientWithFiveStops() { NLinearGradientFill lgf = new NLinearGradientFill(); lgf.GradientStops.Add(new NGradientStop(0.00f, NColor.Red)); lgf.GradientStops.Add(new NGradientStop(0.25f, NColor.Yellow)); lgf.GradientStops.Add(new NGradientStop(0.50f, NColor.LimeGreen)); lgf.GradientStops.Add(new NGradientStop(0.75f, NColor.RoyalBlue)); lgf.GradientStops.Add(new NGradientStop(1.00f, NColor.BlueViolet)); lgf.SetAngle(new NAngle(90, NUnit.Degree)); return(lgf); }
NLinearGradientFill GradientInStretchMode() { NLinearGradientFill lgf = new NLinearGradientFill(); lgf.GradientStops.Add(new NGradientStop(0.0f, NColor.Red)); lgf.GradientStops.Add(new NGradientStop(0.4f, NColor.BlueViolet)); lgf.GradientStops.Add(new NGradientStop(0.5f, NColor.LavenderBlush)); lgf.GradientStops.Add(new NGradientStop(0.6f, NColor.BlueViolet)); lgf.GradientStops.Add(new NGradientStop(1.0f, NColor.Red)); lgf.SetAngle(new NAngle(45, NUnit.Degree)); // FIX: Gradient Transform // lgf.MappingMode = ENGradientMappingMode.Stretch; return(lgf); }