Creates a copy of a brush with the specified opacity. - CSharp System.Windows.Media

CSharp examples for System.Windows.Media:Brush

Description

Creates a copy of a brush with the specified opacity.

Demo Code


using System.Windows.Media;
using System.Windows;
using System.Linq;
using System.Collections.Generic;

public class Main{
        /// <summary>
        /// Creates a copy of a brush with the specified opacity.
        /// </summary>
        /// <param name="brush">
        /// The brush to copy.
        /// </param>
        /// <param name="opacity">
        /// The opacity.
        /// </param>
        /// <returns>
        /// </returns>
        public static Brush ChangeOpacity(Brush brush, double opacity)
        {/*w  w  w  . j av  a  2  s . c om*/
            brush = brush.Clone();
            brush.Opacity = opacity;
            return brush;
        }
}

Related Tutorials