Creates a gray brush. - CSharp System.Windows.Media

CSharp examples for System.Windows.Media:Brush

Description

Creates a gray brush.

Demo Code


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

public class Main{
        /// <summary>
        /// Creates a gray brush.
        /// </summary>
        /// <param name="intensity">
        /// The intensity of the gray color.
        /// </param>
        /// <returns>
        /// </returns>
        public static SolidColorBrush CreateGrayBrush(double intensity)
        {// ww  w . ja v a 2  s .c  o m
            var b = (byte)(255 * intensity);
            return new SolidColorBrush(Color.FromArgb(255, b, b, b));
        }
}

Related Tutorials