Example #1
0
		public object Clone()
		{
			FillGradient fg = new FillGradient(startColor, stopColor);
			fg.Direction = direction;
			fg.IsInverted = isInverted;
			return fg;
		}
Example #2
0
		/// <summary>
		/// Creates a FillGradient from an XML element.
		/// </summary>
		/// <param name="reader"> </param>
		/// <returns> </returns>
		/// <remarks>The element should have a start and stop attributes 
		/// that resolve to global colors, and an optional direction.</remarks>
		public static FillGradient FromXml(XmlReader reader)
		{
			// get the colors
			string startName = reader.GetRequiredString("start");
			string stopName = reader.GetRequiredString("stop");
			FillGradient grad = new FillGradient(ColorManager.Global[startName], ColorManager.Global[stopName]);
			
			// get the direction (optional)
			string dirString = reader.GetAttribute("direction");
			if (dirString != null)
				grad.Direction =(GradientDirection)Enum.Parse(typeof(GradientDirection), dirString);	
			
			// get isInverted (optional)
			string invString = reader.GetAttribute("inverted");
			if (invString != null)
				grad.IsInverted = Boolean.Parse(invString);	
			
			return grad;
		}