StyledText.Bold

From Real Software Documentation

Jump to: navigation, search
Method
StyledText.Bold ( Start as Integer, Length as Integer ) As Boolean

Gets or sets the Bold style to the selected text in Text.

Notes

Start is the starting position in Text. Start starts at zero. The default value for Length is 1. Returns a Boolean. Use assignment syntax to set the value.


Example

This example sets several font attributes in a StyledText.

Dim Text as String // text to be displayed in TextArea
Dim st,ln as Integer // start and length values of a paragraph
//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 RB to take care of my projects."+EndOfLine _
+"That's because the RS Engineering staff is just so awesome!"
TextArea1.StyledText.Text = text //four paragraphs in Text

textarea1.StyledText.StyleRun(2).Size=30
TextArea1.StyledText.Bold(5, 2) = True
TextArea1.StyledText.TextColor(5, 2) = &cFF0000 //bold and red
TextArea1.StyledText.Size( 7, 10) = 16
TextArea1.StyledText.Underline(12, 4) = True //16 pt underline
TextArea1.StyledText.Size(100, 4) = 18
TextArea1.StyledText.TextColor(100, 4) = &cFF00FF //18 pt and Magenta
TextArea1.StyledText.Font(0, Len(text) ) = "Comic Sans MS"
//center aliign second paragraph
TextArea1.StyledText.ParagraphAlignment(1)=Paragraph.AlignCenter
//set this paragraph in Helveticta, 18 pt bold, red
//first get the start and length values for this paragraph...
st=TextArea1.StyledText.Paragraph(1).StartPos
ln=TextArea1.StyledText.Paragraph(1).Length+1

//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
Personal tools