I am currently developing an open source IRC server and I am using a Rich Text Box control as a console to display data. This function will append the specified rtb using the specified text, font, font size, color, and style.
Code:
Public Sub Writeln(ByRef RTB As RichTextBox, ByVal sText As String, ByVal sFont As String, ByVal fSize As Integer, ByVal fColor As Color, ByVal fStyle As FontStyle)
RTB.SelectionColor = fColor
RTB.SelectionFont = New Font(sFont, fSize, fStyle)
RTB.AppendText(sText & vbNewLine)
End Sub
An example use:
Code:
Writeln(RichTextBox1, "Hello World!", "Verdana", 8, Color.Red, 1)
Writeln(RichTextBox1, "This", "Verdana", 8, Color.Blue, 2)
Writeln(RichTextBox1, "is", "Verdana", 8, Color.Green, 3)
Writeln(RichTextBox1, "a", "Verdana", 8, Color.Orange, 4)
Writeln(RichTextBox1, "test!", "Verdana", 8, Color.Yellow, 5)
Picture of the example:
