0
作業,我需要創建一個像http://typeracer.com/一樣的程序。下劃線在VB中重複單詞
繼承人什麼我迄今所做的:
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
的問題是,重複的單詞沒有得到下劃線的,爲什麼呢?
謝謝,爲了指出 –