/// <summary>
        /// Initializes a new instance of the <see cref="XLinearGradientBrush"/> class.
        /// </summary>
        public XLinearGradientBrush(XRect rect, XColor color1, XColor color2, XLinearGradientMode linearGradientMode) : base(color1, color2)
        {
            if (!Enum.IsDefined(typeof(XLinearGradientMode), linearGradientMode))
            {
                throw new InvalidEnumArgumentException("linearGradientMode", (int)linearGradientMode, typeof(XLinearGradientMode));
            }

            if (rect.Width == 0 || rect.Height == 0)
            {
                throw new ArgumentException("Invalid rectangle.", "rect");
            }

            _useRect            = true;
            _rect               = rect;
            _linearGradientMode = linearGradientMode;
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XLinearGradientBrush"/> class.
 /// </summary>
 public XLinearGradientBrush(Rect rect, XColor color1, XColor color2, XLinearGradientMode linearGradientMode)
     : this(new XRect(rect), color1, color2, linearGradientMode)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="XLinearGradientBrush"/> class.
 /// </summary>
 public XLinearGradientBrush(Rectangle rect, XColor color1, XColor color2, XLinearGradientMode linearGradientMode)
   : this(new XRect(rect), color1, color2, linearGradientMode)
 {
 }
    /// <summary>
    /// Initializes a new instance of the <see cref="XLinearGradientBrush"/> class.
    /// </summary>
    public XLinearGradientBrush(XRect rect, XColor color1, XColor color2, XLinearGradientMode linearGradientMode)
    {
      if (!Enum.IsDefined(typeof(XLinearGradientMode), linearGradientMode))
        throw new InvalidEnumArgumentException("linearGradientMode", (int)linearGradientMode, typeof(XLinearGradientMode));

      if (rect.Width == 0 || rect.Height == 0)
        throw new ArgumentException("Invalid rectangle.", "rect");

      this.useRect = true;
      this.color1 = color1;
      this.color2 = color2;
      this.rect = rect;
      this.linearGradientMode = linearGradientMode;
    }