Color To the RGB Int value. - CSharp System.Drawing

CSharp examples for System.Drawing:Color RGB

Description

Color To the RGB Int value.

Demo Code


using System.Drawing;

public class Main{
        /// <summary>
        /// To the RGB.
        /// </summary>
        /// <param name="this">
        /// The this.
        /// </param>
        /// <returns>
        /// int.//w ww .  j  a  v a  2 s.c om
        /// </returns>
        public static int ToRGB(this Color @this)
        {
            // https://social.msdn.microsoft.com/Forums/en-US/72fb1758-b163-429d-a1e6-3881998635b4/when-using-toargb-i-get-negative-numbers?forum=vblanguage
            return @this.R * 256 * 256 + @this.G * 256 + @this.B;
        }
}

Related Tutorials