NRichTextLabel anchor color


https://www.nevron.com/Forum/Topic9410.aspx
Print Topic | Close Window

By Craig Swearingen - 9 Years Ago
I've been using the NRichTextLabel with anchor tags ( i.e., <a href="url">my link</a> ) and this works fine.  I can get the event when the user clicks on these links and see the url and the link text.  I'm using a darker background color for the NRichTextLabel background, however, and the blue link color makes the text hard to read.  How can I change the color of the link text from blue to something else?
By Nevron Support - 9 Years Ago
Hello Craig,

To handle the user click on the hyperlink you need to attach to HyperLinkClick event of NRichTextLable.Item property:
nRichTextLabel1.Item.HyperLinkClick += Item_HyperLinkClick;


To change the color of the hyperlink you need to surround the anchor tag with font tag with desired color:
nRichTextLabel1.Text = "<font color=\'red\'><a href=\"url\">my link</a></font>";

By Craig Swearingen - 9 Years Ago
Thanks.  I was wanting to use a color from the palette.  This seems to work:    

     anchor = "<font color=\'";
     Color c = NUIManager.Palette.HighlightText;
     String strHtmlColor = ColorTranslator.ToHtml(c);
     anchor += strHtmlColor;     
     anchor += "\'>";