NRichTextLabel anchor color


Author
Message
Craig Swearingen
Craig Swearingen
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
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
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
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
Craig Swearingen
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
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 += "\'>";


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic
1 active, 1 guest, 0 members, 0 anonymous
No members currently viewing this topic!

Login

Explore
Messages
Mentions
Search