/// <summary>
 /// Initializes the collection with the two color blend.
 /// </summary>
 /// <param name="collection">Collection to initialize.</param>
 /// <param name="backColor1">Solid Color</param>
 public static void InitializeCollection(BackgroundColorBlendCollection collection, Color backColor)
 {
     collection.Clear();
     collection.Add(new BackgroundColorBlend(backColor, 0f));
 }
Exemple #2
0
        public BackgroundColorBlendCollection GetColorBlendCollection()
        {
            BackgroundColorBlendCollection cbc = new BackgroundColorBlendCollection();

            float[] cp = _Positions;

            if (cp == null || cp.Length != _Colors.Length)
            {
                cp = new float[_Colors.Length];

                float f = 1 / _Colors.Length;

                for (int i = 0; i < cp.Length; i++)
                    cp[i] = i * f;

                cp[_Colors.Length - 1] = 1;
            }

            for (int i = 0; i < _Colors.Length; i++)
                cbc.Add(new BackgroundColorBlend(_Colors[i], cp[i]));

            return (cbc);
        }