Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ForeColor with codes color

Tags:

c#

asp.net

I have created dynamically HyperLink. And I want to change the color by adding a color code.

HyperLink hpl = new HyperLink();
hpl.Text = "SomeText";
hpl.ForeColor = "#5BB1E6";

//Cannot implicitly convert type 'string' to 'System.Drawing.Color

But I can't.

How to add codes color to ForeColor ?

Is it possible?

like image 222
OammieR Avatar asked May 17 '12 04:05

OammieR


1 Answers

Use the following code

HyperLink hpl = new HyperLink();
hpl.Text = "SomeText";
hpl.ForeColor = System.Drawing.ColorTranslator.FromHtml("#5BB1E6");
like image 86
Raab Avatar answered Oct 06 '22 05:10

Raab