|
-
Jul 4th, 2000, 10:57 AM
#1
Thread Starter
Frenzied Member
Okay, how do I choose sertain text to change color, or to bold or italics?
And also, someone gave me code a while ago to put pictures into richtextboxs but I lost the code, can someone give it to me again. Thanks guys.
-
Jul 4th, 2000, 11:19 AM
#2
PowerPoster
You can modify selected text like:
Code:
Text1.SelColor = 255
Text1.SelBold = 1
...
Or you can add ie. red text like this:
Code:
Text1.SelColor = 255
Text1.SelText = "Red Test"
Text1.SelColor = RGB(0, 0, 255)
Text1.SelText = "Blue Test"
Everything clear?
-
Jul 4th, 2000, 11:38 AM
#3
To Put Picture's in a RichTextBox, you can just copy the picture, and Paste it in. (To get the Edit menu to appear when you Right-Click, set the AutoVerbMenu property to True.
Use the SelBold, SelItalic, SelUnderline and SelStrikeThru properties to change the Selected text to any of the 4 styles.
Code:
RichTextBox1.SelBold = Not RichTextBox1.SelBold
RichTextBox1.SelItalic = Not RichTextBox1.SelItalic
RichTextBox1.SelUnderline = Not RichTextBox1.SelUnderline
RichTextBox1.SelStrikeThru = Not RichTextBox1.SelStrikeThru
Use SelColor to change to a different Colour.
Code:
'Changes to Blue colour
RichTextBox1.SelColor = vbBlue
-
Jul 4th, 2000, 02:49 PM
#4
Or you can change a certain portion of the text a different color and leave the rest black or any other color.
Code:
Private Sub Form_Load ()
With RichTextBox1
.Text = "Welcome to the RichTextBox Sample Source Code!"
.SelStart = 0
.SelLength = Len(.Text)
.SelFontName = "Arial"
.SelFontSize = 10
.SelAlignment = rtfCenter
.SelStart = InStr(.Text, "RichTextBox") - 1
.SelLength = Len("RichTextBox")
.SelFontName = "Courier New"
.SelColor = vbBlue
.SelStart = InStr(.Text, "Sample Source Code") - 1
.SelLength = 4
.SelFontName = "Courier New"
.SelUnderline = True
.SelStart = .SelStart + 1
.SelLength = 1
.SelColor = vbRed
.SelStart = .SelStart + 1
.SelLength = 1
.SelColor = vbBlue
.SelStart = .SelStart + 1
.SelLength = 1
.SelColor = vbGreen
.SelStart = 0
.SelLength = 0
End With
End Sub
-
Jul 4th, 2000, 03:38 PM
#5
Thread Starter
Frenzied Member
Thanks guys. Just what I was looking for
-
Jul 11th, 2000, 02:54 PM
#6
New Member
What about subscript and superscript?
Thanks,
Roger
Roger Eagans
Senior Technician/Programmer
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|