How to manage asp.net color?

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?
 
D

Damien

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,434
Messages
2,571,690
Members
48,796
Latest member
Greg L.

Latest Threads

Top