Profile Picture

NRichTextLabel anchor color

Posted By Craig Swearingen 9 Years Ago
Author
Message
Craig Swearingen
Question Posted 9 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: 7 Years 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
This post has been flagged as an answer
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
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 9 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: 7 Years 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