A Paragraph of StyledText.
EndPosition As Integer
End position of the Paragraph (1-based).
This property is read-only.
Bold the last character of the text:
TextArea1.StyledText.Text = "Hello, World!" // Bold the "!" Var theEnd As Integer = TextArea1.StyledText.Paragraph(1).EndPositiion TextArea1.StyledText.Bold(theEnd - 1, 1) = True
Length As Integer
Length (in characters) of the Paragraph.
TextArea1.StyledText.Text = "Hello, World!" // Bold the text Var len As Integer = TextArea1.StyledText.Paragraph(1).Length TextArea1.StyledText.Bold(0, len) = True
StartPosition As Integer
The starting position of the Paragraph.
Bold the first character of the Paragraph:
TextArea1.StyledText.Text = "Hello, World!" // Bold the first character Var first As Integer = TextArea1.StyledText.Paragraph(1).StartPosition TextArea1.StyledText.Bold(first, 1) = True
TextAlignment As TextAlignment
Gets the text alignment of the Paragraph.
The values of this property are set using the TextAlignments enumeration.
To set the alignment of a Paragraph, call the ParagraphAlignment method of the StyledText class. You can use the Paragraph or the TextField alignment constants to set a Paragraph alignment using the ParagraphAlignment method.
This is an example of a right-aligned first Paragraph.
Var st As New StyledText st = TextArea1.StyledText TextArea1.AddText("This is the added text.") st.Bold(0, 4) = True st.Paragraph(0).TextAlignment = TextAlignments.Right
Use the Paragraph class to refer to a Paragraph of text within a block of StyledText. A Paragraph is defined as all the text between two Paragraph separators. A separator can be the EndOfLine function or the correct separator character for the platform on which the application is running. Completely empty paragraphs (e.g., blank lines) do not count as paragraphs.
The Paragraph has one style attribute, TextAlignment. It gets the current alignment for the Paragraph. The alignment is set by calling the StyledText.ParagraphTextAlignment method of the StyledText class.
The following example sets a Paragraph's alignment to Centered. It then gets the starting position and length of the Paragraph via the Paragraph class and applies several style attributes to the whole Paragraph. The TextArea that displays the styled text must have the MultiLine and Styled properties set to True.
Var Text As String Var st, ln As Integer // define four paragraphs in Text Text = "This is the text that we are going to save " _ + "into our file from the TextArea." + EndOfLine _ + "Isn't that interesting?" + EndOfLine _ + "Man, I sure do love using Xojo to take care of my projects." + EndOfLine _ + "That's because the Xojo staff is just so awesome!" TextArea1.StyledText.Text = text // four paragraphs in Text // center the second paragraph TextArea1.StyledText.Paragraph(1).TextAlignment = TextAlignments.Center // set the second paragraph in Helvetica, 18 pt bold, red // first get its character positions... st = TextArea1.StyledText.Paragraph(1).StartPosition ln = TextArea1.StyledText.Paragraph(1).Length // next apply attributes... TextArea1.StyledText.Bold(st, ln) = True TextArea1.StyledText.Font(st, ln) = "Helvetica" TextArea1.StyledText.Size(st, ln) = 18 TextArea1.StyledText.TextColor(st, ln) = &cFF0000 // red
All project types on all supported operating systems.