我已经动态创建了HyperLink.我想通过添加颜色代码来改变颜色.
HyperLink hpl = new HyperLink(); hpl.Text = "SomeText"; hpl.ForeColor = "#5BB1E6"; //Cannot implicitly convert type 'string' to 'System.Drawing.Color
但我不能.
可能吗?
解决方法
使用以下代码
HyperLink hpl = new HyperLink(); hpl.Text = "SomeText"; hpl.ForeColor = System.Drawing.ColorTranslator.FromHtml("#5BB1E6");