0
Public Sub ChatMessage(ByVal sUser As String, ByVal sMessage As String)
Dim tmpData As String = sUser & ":" & vbTab & sMessage
Dim p As Paragraph = New Paragraph(New Run(tmpData))
p.Foreground = System.Windows.Media.Brushes.LightGreen
p.FontSize = 12
p.Margin = New System.Windows.Thickness(0, 0, 0, 0)
RoomMessages.RichTextBox.Document.Blocks.Add(p)
RoomMessages.RichTextBox.ScrollToEnd()
End Sub
我已將WPF Richtextbox稱爲RoomMessages添加到Windows窗體。 我可以使用上面的代碼添加文本,它適用於添加具有1種顏色和字體的文本。我需要能夠在將它們添加到richtextbox之前更改單詞的顏色。我已經搜索了幾天,但沒有運氣。WPF Richtextbox多種顏色和字體
我見過使用的TextRange或的TextBlocks C#代碼,但havnt能夠讓他們在VB