How to manage asp.net color?

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

I cant to write a function to manage the font color of my web.
The function is like:


using System.Drawing;
public static string FontColor(string sInput, Color myColor)
{
string sRV = "";
sRV = "<font color='" + myColor.ToString() + "'>" + sInput + "</font>";
return sRV;
}

but when I use
FontColor("Test", Color.Red) to call the function,
The return string is
<font color='Color [Red]'>Test</font></font><br>

The color is mistake.

I think I use the wrong namespace.

How can I manage the HTML color?
 
ad said:
I cant to write a function to manage the font color of my web.
The function is like:


using System.Drawing;
public static string FontColor(string sInput, Color myColor)
{
string sRV = "";
sRV = "<font color='" + myColor.ToString() + "'>" + sInput + "</font>";
return sRV;
}

but when I use
FontColor("Test", Color.Red) to call the function,
The return string is
<font color='Color [Red]'>Test</font></font><br>

The color is mistake.

I think I use the wrong namespace.

How can I manage the HTML color?

Look at the ColorTranslator class - it has static methods for
translating Color objects to other formats. For instance, it has a
ToHtml() method.

Damien
 
Back
Top