📄 form1.vb
字号:
Public Class Form1
'Form1 Load,则居中显示
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.CenterToScreen()
Me.AcceptButton = Button6
End Sub
'点击第一个按扭,文本框显示的内容
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = "If the computer does not through sight or sound supply users with information about its processing, they will not have the knowledge necessary to understand what is happening and what the system is doing. "
End Sub
'点击第二个按扭,文本框显示的内容
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = "Making use of users' prior knowledge of and experience with other parts of the same application and other applications on the same platform will make an interface more familiar and easier to use. "
End Sub
'点击第三个按扭,文本框显示的内容
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Text = "The value of accelerators comes primarily from the motor processes of the user. Typing single keys is typically faster than continually moving the hand from keyboard to mouse and pointing to something on the screen. Furthermore, skilled users will develop plans of action that they will want to execute frequently, and an interface that supports this kind of tailoring will allow these plans to be captured in the interface itself. "
End Sub
'点击第四个按扭,文本框显示的内容
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
TextBox1.Text = "This heuristic is simply an admonition to give the user sufficient information to understand error situations. "
End Sub
'点击第五个按扭,文本框显示的内容
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
TextBox1.Text = "This heuristic is an admonition to give the user enough information to understand how to use an application. An application's search feature should allow desired information to be found when a user specifies the gist of its meaning rather than precise wording: people usually remember only gists, not exact wordings. "
End Sub
'点击“Go”’,文本框显示的内容的情况
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim variable As String
variable = TextBox2.Text
If variable = "" Then
TextBox1.Text = "Please enter a valid search string."
End If
If variable.Length < 3 And variable <> "" Then
TextBox1.Text = "The key word or phrase must be three or more characters long"
End If
If variable.Length >= 3 And variable <> "" Then
display()
End If
End Sub
Public Sub display()
Dim keyword As String '用于记录搜索字符
keyword = TextBox2.Text
Dim str(5) As String '要搜索的字符串
str(1) = "If the computer does not through sight or sound supply users with information about its processing, they will not have the knowledge necessary to understand what is happening and what the system is doing. "
str(2) = "Making use of users' prior knowledge of and experience with other parts of the same application and other applications on the same platform will make an interface more familiar and easier to use. "
str(3) = "The value of accelerators comes primarily from the motor processes of the user. Typing single keys is typically faster than continually moving the hand from keyboard to mouse and pointing to something on the screen. Furthermore, skilled users will develop plans of action that they will want to execute frequently, and an interface that supports this kind of tailoring will allow these plans to be captured in the interface itself. "
str(4) = "This heuristic is simply an admonition to give the user sufficient information to understand error situations. "
str(5) = "This heuristic is an admonition to give the user enough information to understand how to use an application. An application's search feature should allow desired information to be found when a user specifies the gist of its meaning rather than precise wording: people usually remember only gists, not exact wordings. "
Dim found As Boolean
found = False '记录是否查找成功
Dim i As Integer '循环变量
For i = 1 To str(1).Length
If found = True Then
Exit For
End If
If Mid(str(1), i, keyword.Length) = keyword Then
found = True
TextBox1.Text = "Mock Heuristic One:" & vbCrLf & str(1)
End If
Next
For i = 1 To str(2).Length
If found = True Then
Exit For
End If
If Mid(str(2), i, keyword.Length) = keyword Then
found = True
TextBox1.Text = "Mock Heuristic Two:" & vbCrLf & str(2)
End If
Next
For i = 1 To str(3).Length
If found = True Then
Exit For
End If
If Mid(str(3), i, keyword.Length) = keyword Then
found = True
TextBox1.Text = "Mock Heuristic Three:" & vbCrLf & str(3)
End If
Next
For i = 1 To str(4).Length
If found = True Then
Exit For
End If
If Mid(str(4), i, keyword.Length) = keyword Then
found = True
TextBox1.Text = "Mock Heuristic Four:" & vbCrLf & str(4)
End If
Next
For i = 1 To str(5).Length
If found = True Then
Exit For
End If
If Mid(str(5), i, keyword.Length) = keyword Then
found = True
TextBox1.Text = "Mock Heuristic Five:" & vbCrLf & str(5)
End If
Next
If found = False Then
TextBox1.Text = "No match found."
End If
End Sub
'查找关键字的文本框改变,则清空文本框1的显示
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
TextBox1.Text = ""
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -