See also:
Generally
Paragraph formatting
All formatting characters are enclosed in braces {...} - otherwise they may not occur in the text! In the clip area no spaces are allowed. The formatting is restricted to the relevant paragraph of text - Example:
correct: | |
RtfLabel1.Text = "{b}This text is bold.{b} " & CRLF & "{b}This text also.{b} " | |
incorrect: | |
RtfLabel1.Text = "{b}This text is bold. " & CRLF & "This text also.{b} " |
Bold: {b} - text bold - token must be present in pairs.
Italic: {i} - text italic - token must be present in pairs.
TextColor: {tc0} ... {tc9} - font color for text areas - token must be present in pairs.
Small: {s} - small text size - token must be present in pairs.
Hyperlink: {h/EventText}DisplayText{h}
Anchor: {a/Name}
Bold: {b} text bold - token must be present in pairs. Example:
RtfLabel1.Text = "This {b}word{b} is bold. " | |
![]() |
Italic: {i} - text italic - token must be present in pairs. Example:
RtfLabel1.Text = "This {i}word{i} is italic. " | |
![]() |
TextColor: {tc0} ... {tc9} - font color for text areas - token must be present in pairs. The number 0 to 9 is the index of the text colors. Example:
RtfLabel1.TextColor = Colors.Black 'Default font color | |
RtfLabel1.SetTextColors(0, Colors.Red) 'Color for ColorId 0 | |
RtfLabel1.SetTextColors(1, Colors.Blue) 'Color for ColorId 1 | |
'... | |
RtfLabel1.Text = "This {tc0}word{tc0} is red, this {tc1}{b}blue{b}{tc1}, the rest is black. " | |
![]() |
Small: {s} - small text size - token must be present in pairs. Example:
RtfLabel1.TextSize = 20 'Default font size | |
RtfLabel1.TextSizeSmall = 0.8 'Factor for small font | |
RtfLabel1.Text = "This {s}word{s} is smaller than the rest. " 'Font size: 20 * 0.8 = 16 |
|
![]() |
|
If the font size is specified for the paragraph, the factor refers to this size: ({pts = ParagraphTextSize) | |
RtfLabel1.Text = "{pts/1.5}This {s}word{s} is smaller than the rest. " 'Font size: 20 * 1.5 * 0.8 = 24 |
|
![]() |
Hyperlinks can be inserted at any place - as a part of a word or as several comprehensive words. The structure is: {h/EventText}DisplayText{h}. The settings apply to all hyperlinks in the text. Example:
RtfLabel1.LinkFormat = 1 '1=underlined | 2=colored | 3=underlined and colored | |
RtfLabel1.LinkTextColor = Colors.Magenta 'only for LinkFormat > 1 | |
RtfLabel1.LinkPressedColor = Colors.Yellow 'background color when pressed | |
RtfLabel1.LinkPressedCornerRadius = 0 'corner radius 0=none) | |
RtfLabel1.Text = "Text with {h/MyLink1}hyperlink{h} and so on. " | |
RtfLabel1.Text = "Text {h/MyLink2}with hyperlink{h} and so on. " | |
RtfLabel1.Text = "Text with Hyper{h/MyLink3}link{h} and so on. " | |
![]() |
|
After "{h/..." stands the text for the event LinkClick. Example: | |
Sub RtfLabel1_LinkClick(LinkEventText As String) Log("LinkClick: " & LinkEventText) End Sub |
|
The EventText can not contain spaces! |
Anchors can be inserted anywhere. They serve as anchor links to longer texts. The structure is: {a/Name}. "Name" can be any text without spaces.
RtfLabel1.Text = "... This is {a/MyAnchor}a text with anchor. " | |
With GoToAnchor the passage is brought into the visible region: | |
RtfLabel1.GoToAnchor("MyAnchor") |
(to top)