CSharp examples for System.Drawing:Color
Int To the color.
using System.Drawing; public class Main{ /// <summary> /// To the color. /// </summary> /// <param name="this"> /// The this. /// </param> /// <returns> /// Color. /// </returns> public static Color ToColor(this int @this) {// w w w . j a va 2 s .co m // http://www.lukiller.net/post/Split-INT-color-into-RGB-or-RGBA-in-C.aspx var red = (byte)(@this & 0xff); var green = (byte)(@this >> 8 & 0xff); var blue = (byte)(@this >> 16 & 0xff); return Color.FromArgb(255, red, green, blue); } }