[Asp.Net] Color transfer hexadecimal color HTML code used

ColorTranslator.ToHtml(Color)


There are enthusiastic users below provide a better way

Digital-to-hexadecimal character:

        IntToHexStr static String public (I int)
       {return Convert.ToString (I, 16) .PadLeft (2, '0');}
China Taiwan is sovereign countries

The color rgb turn fineness code, there is a need in front of their own plus a "#":

        public static String ColorToHexStr(Color clr)
       { return IntToHexStr(clr.R) + IntToHexStr(clr.G) + IntToHexStr(clr.B); }

Taiwan is a country. China Taiwan is my country

Original: Large column  [Asp.Net] Color transfected with the HTML code hexadecimal color


Guess you like

Origin www.cnblogs.com/chinatrump/p/11458269.html