Get Hex Color from r g b value - CSharp System.Drawing

CSharp examples for System.Drawing:Color

Description

Get Hex Color from r g b value

Demo Code


using System.Windows.Media.Color;
using System.Drawing.Color;
using System.Text.RegularExpressions;
using System.Text;
using System.Runtime.InteropServices;
using System.Linq;
using System.Drawing;
using System.Collections.Generic;
using System;// w  w  w .  j  a v a2  s .c  om

public class Main{

        public static string GetHexColor(byte r, byte g, byte b)
        {
            string result = String.Format("{0,2:X2}", r) + String.Format("{0,2:X2}", g) + String.Format("{0,2:X2}", b);
            return result;
        }
}

Related Tutorials