Profile Picture

NRichTextLabel anchor color

Posted By Craig Swearingen 2 Years Ago
Author
Message
Craig Swearingen
Question Posted 2 Years Ago
View Quick Profile
Supreme Being

Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)

Group: Forum Members
Last Active: 9 Months Ago
Posts: 99, Visits: 654
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?

Nevron Support Team
This post has been flagged as an answer
Posted 2 Years Ago
View Quick Profile
Supreme Being

Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)

Group: Moderators
Last Active: Yesterday @ 8:33 AM
Posts: 2,593, Visits: 2,279
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>";



Best Regards,
Nevron Support Team



Craig Swearingen
Posted 2 Years Ago
View Quick Profile
Supreme Being

Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)

Group: Forum Members
Last Active: 9 Months Ago
Posts: 99, Visits: 654
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 += "\'>";





Similar Topics


Reading This Topic