Int32 - FromWin32
Translates a Windows color value to a GDI+ structure.
public static void Main() { int winColor = 0xA000; // C# Extension Method: Int32 - FromWin32 Color color = winColor.FromWin32(); Console.WriteLine(color.Name); Console.WriteLine("R: {0}", color.R); Console.WriteLine("G: {0}", color.G); Console.WriteLine("B: {0}", color.B); }
View Source
using System; #if !NETSTANDARD using System.Drawing; #endif public static partial class Extensions { #if !NETSTANDARD /// <summary> /// Translates a Windows color value to a GDI+ structure. /// </summary> /// <param name="win32Color">The Windows color to translate.</param> /// <returns>The structure that represents the translated Windows color.</returns> public static Color FromWin32(this Int32 win32Color) { return ColorTranslator.FromWin32(win32Color); } #endif }