2011-07-07 11 views

Respuesta

6
Color c = Color.FromArgb(red, green, blue); 
var hexColor = System.Drawing.ColorTranslator.ToHtml(c); 

debe producir "0000FF"

See MSDN

3

Bala R es el clavo para Windows Forms, pero si usted está utilizando ASP.NET aquí es la manera rápida y sucia-:

string cssColor = String.Format("#{0:X2}{1:X2}{2:X2}", red, green, blue); 
-1

uso

byte red = 0; 
byte green = 0; 
byte blue= 255; 
byte[] color={red,green,blue}; 
string s = BitConverter.ToString(color); 
+0

's' será' "00-00-FF" ' –

+0

hmm cierto, gracias por señalar eso – shobhonk

Cuestiones relacionadas