【发布时间】:2017-01-31 18:45:33
【问题描述】:
作业,我需要创建一个类似http://typeracer.com/ 的程序。
这是我到目前为止所做的:
Dim strContent As String = "the texts the text the text"
Dim arrNum As Integer = 0
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
arrContent = strContent.Split(" ")
RichTextBox2.Text = strContent
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
If TextBox1.Text = arrContent(arrNum) + " " Then
TextBox1.Clear()
arrNum = arrNum + 1
End If
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim strSearch As String = arrContent(arrNum)
Dim intIndex As Integer = RichTextBox2.Find(strSearch, 0, RichTextBoxFinds.WholeWord)
If intIndex <> -1 Then
RichTextBox2.SelectionStart = intIndex
RichTextBox2.SelectionLength = strSearch.Length
RichTextBox2.SelectionFont = New Font(RichTextBox2.Font, FontStyle.Bold)
End If
End Sub
问题是重复的单词没有下划线,为什么?
【问题讨论】:
标签: arrays vb.net string richtextbox underline