在WPF中,哪个控件可以实现显示不同颜色文本的功能?
在WPF中,使用哪个控件可以实现显示不同文本的功能,比如说前三行是蓝色的,后三行是绿色的这种感觉。谢谢啦,感激不尽
Option Explicit Private Type 类型 信息 As String 颜色 As Long End Type Dim dstr() As 类型 '保存信息的 Dim Count As Long '信息总个数 Private Const 行高 = 210 '文字高+行距,单位为 缇 Public Sub VIEW(信息 As String, Optional 颜色 As Long = 0) '添加并显示 日志 Dim i As Long For i = 2 To Count dstr(i - 1).信息 = dstr(i).信息 dstr(i - 1).颜色 = dstr(i).颜色 Next i dstr(Count).信息 = 信息 dstr(Count).颜色 = 颜色 Call UserControl_Paint '调用刷新,进行显示内部 End Sub Private Sub UserControl_Paint() Dim i As Long With UserControl .Cls For i = 0 To Count .ForeColor = dstr(i).颜色 .CurrentY = (i - 1) * 行高 UserControl.Print dstr(i).信息 Next i End With End Sub Private Sub UserControl_Resize() Count = Int(UserControl.ScaleHeight / 行高) ReDim dstr(Count) End Sub '注意!不要删除或修改下列被注释的行! 'MappingInfo=UserControl,UserControl,-1,BackColor Public Property Get BackColor() As OLE_COLOR BackColor = UserControl.BackColor End Property Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR) UserControl.BackColor() = New_BackColor PropertyChanged "BackColor" End Property '从存贮器中加载属性值 Private Sub UserControl_ReadProperties(PropBag As PropertyBag) UserControl.BackColor = PropBag.ReadProperty("BackColor", &H8000000F) End Sub '将属性值写到存储器 Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("BackColor", UserControl.BackColor, &H8000000F) End Sub