以下是引用有点甜在2018/6/25 14:42:00的发言:
Dim rt As New Windows.Forms.RichTextBox
rt.Dock = Windows.Forms.DockStyle.Fill
rt.name = "RichTextBox1"
e.Form.Controls("Panel1").BaseControl.Controls.Add(rt)
rt.AppendText("您共计拥有客户 ")
rt.SelectionColor = Color.Red '背景色无效
rt.SelectionFont = New Font("楷体",20,FontStyle.Bold) '字体字号无效
rt.appendText("8888")
rt.SelectionColor = Color.black '背景色无效
rt.SelectionFont = New Font("楷体",20,FontStyle.Bold) '字体字号无效
rt.appendtext(" 家;" & Chr(13) & "其中已建立合作客户 ")
老师,发现了新的问题,还请帮忙解决,在窗口AfterLoad事件中内容加载后,通过窗口的一个按钮,来变更文本内容,但是显示的内容无法更新,同样的代码,不知道是不是还有一个类似刷新的指令啊?
Dim rt As New Windows.Forms.RichTextBox
rt.Dock = Windows.Forms.DockStyle.Fill
'rt.ReadOnly = True
e.Form.Controls("Panel1").BaseControl.Controls.Add(rt)
rt.ResetText()
msgbox(rt.text)
'Dim rt = e.Form.Controls("Panel1").BaseControl.Controls("RichTextBox1")
Dim sts1 As String() = {"您现有客户","已合作客户","当前位于第"}
Dim sts2 As String() = {a1,a2,a3}
Dim sts3 As String() = {"家;","家;","条记录."}
For i As Integer = 0 To sts1.length - 1
If i > 0
rt.AppendText(Chr(13))
End If
msgbox(i)
rt.SelectionColor = Color.black '背景色无效
rt.SelectionFont = New Font("楷体",11) '字体字号无效
rt.AppendText(sts1(i))
msgbox(sts1(i))
rt.SelectionColor = Color.Red '背景色无效
rt.SelectionFont = New Font("楷体",11,FontStyle.Bold) '字体字号无效
rt.appendText(sts2(i))
msgbox(sts2(i))
rt.SelectionColor = Color.black '背景色无效
rt.SelectionFont = New Font("楷体",11) '字体字号无效
rt.appendtext(sts3(i))
msgbox(sts3(i))
msgbox(rt.text)
Next