|
-
Dec 7th, 2001, 03:23 PM
#1
Thread Starter
Lively Member
Change Text Color and Font Character by Character
Hi,
Is there a way to change a single line of text, making half, one color and the other half a different color in bold?
Number of files (150) (150)
-
Dec 7th, 2001, 03:26 PM
#2
Frenzied Member
Not in a text box. But in a Rich Text Box you can.
Im not sure how, but im sure someone will get the
code for ya =)
-
Dec 7th, 2001, 03:28 PM
#3
Thread Starter
Lively Member
For Treeview
I am trying to make my treeview act like Outlook, Displaying items not read in bold surrounded by brackets.
-
Dec 7th, 2001, 03:29 PM
#4
I'm sure you can take this code, and expand it to meet your needs. This little snippet simply changes the color of one word, but the principle for what you wish to do remains the same.
VB Code:
Private Sub Command1_Click()
Dim strWord As String
Dim lPos As Long
strWord = "Hello"
lPos = InStr(1, RichTextBox1.Text, strWord, vbTextCompare)
If lPos > 0 Then
With RichTextBox1
.SelStart = lPos - 1
.SelLength = Len(strWord)
.SelColor = vbRed
.SelStart = Len(RichTextBox1.Text)
End With
End If
-
Dec 7th, 2001, 03:30 PM
#5
Sorry. I submitted the post before I saw your second post specifiying a TreeView control.
-
Dec 7th, 2001, 03:53 PM
#6
Addicted Member
I dont think you can do this with the treeview control. I posted the same question a while ago, and nobody had any ideas. The only thing you can do in the treeview is format the entire node text with simple things like bold and underline.
Shawn Hull
VB6, SP3 (Professional Edition)
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
|