|
-
May 31st, 2004, 09:58 AM
#1
Thread Starter
Hyperactive Member
Rich Textbox Question
Is it possible to place color tags in a string so the rich textbox will automatically display the correct color WITHOUT have to set the forecolor on the physical control?
Basically something like..
Dim s as String = "<RED>This would be red...<BLUE>This is Blue..."
The only thing I could find that would resemble something like that is the RTF option but that is for parsing actual text files?
Anyone know?
-
May 31st, 2004, 01:37 PM
#2
Sleep mode
-
May 31st, 2004, 05:17 PM
#3
Thread Starter
Hyperactive Member
Hmm, well I don't have office installed on my machine (or own it for that matter).. Surely there is a way to do it without having to install something..
-
May 31st, 2004, 06:21 PM
#4
Fanatic Member
Try this from MSDN: SelectionColor Property - RichTextBox
Here's a code snippet from the article:
VB Code:
Public Sub ChangeMySelectionColor()
Dim colorDialog1 As New ColorDialog()
' Set the initial color of the dialog to the current text color.
colorDialog1.Color = richTextBox1.SelectionColor
' Determine if the user clicked OK in the dialog and that the color has
' changed.
If (colorDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK) _
And Not(colorDialog1.Color.Equals(richTextBox1.SelectionColor)) Then
' Change the selection color to the user specified color.
richTextBox1.SelectionColor = colorDialog1.Color
End If
End Sub
www.RealisticGraphics.net
Running VS.Net Enterprise & VB 6
Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML
MSN Messenger: kmsheff
-
Jun 1st, 2004, 05:15 AM
#5
Thread Starter
Hyperactive Member
Thanks RealisticGraphics but that's not what I'm looking for.
I am coding a Telnet client that handles Ansi Ascii colors.. Basically the server determines the color of the text by the Codes it imbedes into the text before sending it to the telnet client.. I need to be able to build a method that strips out the embeded color codes and replace them with some type of color tag that a rich text box will automatically recognize and change the color.
Example would be...
Dim Str as String = Chr(27) & "[1;40;33m" & "This is bold with black backround and yellow forground"
Now I run this through a function that would return the string with the correct tags that a richtextbox would recognize..
Any thoughts?
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
|