Change the alpha value of a color - CSharp System.Drawing

CSharp examples for System.Drawing:Color

Description

Change the alpha value of a color

Demo Code


using System.Windows.Media;
using System.Globalization;
using System;//from  ww w .ja v a  2s .  co  m

public class Main{
        /// <summary>
        /// Change the alpha value of a color
        /// </summary>
        /// <param name="c">
        /// </param>
        /// <param name="alpha">
        /// </param>
        /// <returns>
        /// </returns>
        public static Color ChangeAlpha(this Color c, byte alpha)
        {
            return Color.FromArgb(alpha, c.R, c.G, c.B);
        }
}

Related Tutorials