Example #1
0
        public static void AddBrush(this SerializationInfo info, string name, Brush brush)
        {
            var solidBrush = brush as SolidBrush;

            if (solidBrush != null)
            {
                info.AddSolidBrush(name, solidBrush);
                return;
            }

            var linearGradientBrush = brush as LinearGradientBrush;

            if (linearGradientBrush != null)
            {
                info.AddLinearGradientBrush(name, linearGradientBrush);
                return;
            }

            throw new ArgumentException("Brush type not supported.");
        }