I have been trying to add some underlines to some selected text. I want the underlines to be thick and colourful so changing the span underlinedecoration came to my mind. None of the below underline decoration settings worked, but changing the fontsize or anything else about the span seemed to work fine. What should I do/add/change/combine in this case to make it work?
var a = new DoubleCollection {length, 0};
span.UnderlineDecoration = new ThickLineDecoration(a);
span.UnderlineDecoration = UnderlineTypes.ThickLine;
radRichTextBox.ChangeUnderlineDecoration(UnderlineTypes.ThickLine);
4 Answers, 1 is accepted
In order to underline the current selection or the inline where the caret is located in case the selection is empty, you should use the ChangeUnderlineDecoration() method of RadRichTextBox.
this.radRichTextBox.ChangeUnderlineDecoration(UnderlineTypes.ThickLine);
That said I am not sure why you are having troubles with this, so we will appreciate it if you can provide further details on the issue or a sample project that demonstrates it.
I'm looking forward to your reply.
Regards,
Petya
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Can i customise the underline decoration somewhere so that the thick line shows up as thick as i want? I want it to be very obvious on the document, a line/thickline/doubeline is far too thin for me in this case.
I've been working on this for a long time, just trying to get a really thick line under certain texts, and inserting table cells did not work since table wont wrap around the text in the same line.. i'm running out of ideas, it'll be good that i can just change the thickness to be what i want for the thickline decoration. Looking forward to your answer. Thanks.
Regards,
Mia
RadRichTextBox uses UILayers in order to show different types of content - images, table borders, highlights, etc. The underline decorations also have a dedicated layer. You can try creating a custom UI layer that shows thicker lines under the text when it has Thick underline applied. You can find basic information in this help article and check the demos for creating a custom UI layer in the online examples and preview/download the source of the example (as a standalone application) here.
In your case you can create a custom UI layer that filters the spans depending on the UnderlineDecoration and add UIElements to the layer that will make the line thicker.
Have in mind, though, that the UILayers are used for presentation purposes only, so when exported to docx, rtf, etc., the size of the underlines will remain thinner.
Iva Toteva
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>