I am using the following code to color certain parts of the text in a RichTexbox.
Private Sub SetRed()
Dim I, L As Integer, S As String
L = 106
For I = 2 To nStk + 2
With RTB
.SelectionStart = I * L + 14
.SelectionLength = 16
S = .Text.Substring(.SelectionStart, 8)
If S.Contains("-") Then
.SelectionColor = Color.Red
Else
.SelectionColor = Color.Green
End If
End With
Next I
End Sub
This works OK when the data is shown in the RichTexbox.
But when I send the RichTextbox.Text to the printer, all of it prints in black.
How can I get it to print the colored text the same as it appears in the RichTextbox?
Private Sub SetRed()
Dim I, L As Integer, S As String
L = 106
For I = 2 To nStk + 2
With RTB
.SelectionStart = I * L + 14
.SelectionLength = 16
S = .Text.Substring(.SelectionStart, 8)
If S.Contains("-") Then
.SelectionColor = Color.Red
Else
.SelectionColor = Color.Green
End If
End With
Next I
End Sub
This works OK when the data is shown in the RichTexbox.
But when I send the RichTextbox.Text to the printer, all of it prints in black.
How can I get it to print the colored text the same as it appears in the RichTextbox?