|
-
Jun 15th, 2006, 04:17 AM
#1
Thread Starter
Addicted Member
RichTextBox and background colour
Wotcha, folks.
I've been searching for a way in which to change the colour on just a selected portion of a rich text box.
We have a RTB that lists information that is then checked and coloured according to the information it finds. I.e any text with the words "problems" is highlighted in red, etc.
As we've now run out of distinguishable colours, I'd like to change the selected background colour.
There was one relatively similar question asked here earlier, but it never really went anywhere.
Is it possible to change the background colour of a selected piece of text in a RichTextBox?
Much ta.
Jack.
-
Jun 15th, 2006, 04:45 AM
#2
Re: RichTextBox and background colour
VB Code:
With Me.RichTextBox1
.Text = ""
.SelBold = True
.SelFontSize = 20
.SelText = "Dataare" & vbNewLine
.SelFontSize = 8
.SelBold = False
.SelColor = RGB(200, 0, 0)
.SelText = "Name:- "
.SelColor = vbBlack
.SelText = "shakti singh dulawat" & vbNewLine & vbNewLine & "Email:- "
.SelColor = &HC00000
End With
To change the formatting of existing text, select some text and then change the desired "SEL" properties.
VB Code:
With Me.RichTextBox1
.SelStart = 0
.SelLength = 7
.SelBold = False
.SelItalic = True
.SelColor = vbYellow
End With
-
Jun 15th, 2006, 05:00 AM
#3
Thread Starter
Addicted Member
Re: RichTextBox and background colour
Thanks for the reply, but I did mean the background colour.
I'm fine with the font colour / style itself.
J.
-
Jun 15th, 2006, 05:04 AM
#4
Re: RichTextBox and background colour
VB Code:
With Me.RichTextBox1
.SelStart = 0
.SelLength = 7
.SelBold = False
.SelItalic = True
.SelColor = vbYellow
End With
-
Jun 15th, 2006, 05:12 AM
#5
Re: RichTextBox and background colour
To change the formatting of existing text, select some text and then change the desired "SEL" properties.
VB Code:
With Me.RichTextBox1
.SelStart = 0
.SelLength = 7
.SelBold = False
.SelItalic = True
.BackColor = vbRed
End With
-
Jun 15th, 2006, 05:16 AM
#6
Re: RichTextBox and background colour
Shakti: he wanted to change the back color of selected text i.e. highlight selected text, but you are posting code to just change the text color, i.e. forecolor. Please read the post clearly and then post your solution.
Jack: I doubt you can change the back color of selected text in RTB. May be experts can help you.
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
Jun 15th, 2006, 05:19 AM
#7
Re: RichTextBox and background colour
-
Jun 15th, 2006, 05:39 AM
#8
Thread Starter
Addicted Member
Re: RichTextBox and background colour
Aww nadgers!
Okay. Thanks for the input, guys.
jack.
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
|