?? 打字題.frm
字號:
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form Form4
Caption = "打字題"
ClientHeight = 6525
ClientLeft = 60
ClientTop = 345
ClientWidth = 7680
Icon = "打字題.frx":0000
LinkTopic = "Form4"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6525
ScaleWidth = 7680
StartUpPosition = 3 '窗口缺省
Begin RichTextLib.RichTextBox RichTextBox2
Height = 2295
Left = 120
TabIndex = 0
Top = 3240
Width = 7215
_ExtentX = 12726
_ExtentY = 4048
_Version = 393217
Enabled = -1 'True
ScrollBars = 2
TextRTF = $"打字題.frx":06EA
End
Begin VB.Timer Timer1
Interval = 1000
Left = 5040
Top = 5640
End
Begin RichTextLib.RichTextBox RichTextBox1
Height = 2175
Left = 120
TabIndex = 1
Top = 480
Width = 7095
_ExtentX = 12515
_ExtentY = 3836
_Version = 393217
BackColor = -2147483648
Enabled = 0 'False
ScrollBars = 2
TextRTF = $"打字題.frx":0779
End
Begin VB.CommandButton Command1
Caption = "退出打字題"
Height = 495
Left = 6000
TabIndex = 2
Top = 5760
Width = 1335
End
Begin VB.Frame Frame1
Caption = "注意"
ForeColor = &H000000FF&
Height = 735
Left = 240
TabIndex = 5
Top = 5640
Width = 6735
Begin VB.Label Label10
Caption = "秒"
Height = 255
Left = 3600
TabIndex = 10
Top = 360
Width = 375
End
Begin VB.Label Label9
Caption = "Label9"
Height = 255
Left = 2640
TabIndex = 9
Top = 360
Width = 735
End
Begin VB.Label Label8
Caption = "分"
Height = 255
Left = 2040
TabIndex = 8
Top = 360
Width = 375
End
Begin VB.Label Label7
Caption = "Label7"
Height = 255
Left = 1200
TabIndex = 7
Top = 360
Width = 735
End
Begin VB.Label Label6
Caption = "剩余時間:"
Height = 255
Left = 120
TabIndex = 6
Top = 360
Width = 975
End
End
Begin VB.Label Label4
Caption = "請在下面的編輯框中錄入上面的文字,蘭色表示正確,紅色表示錯誤!"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 375
Left = 240
TabIndex = 12
Top = 2760
Width = 6975
End
Begin VB.Label Label3
Caption = "Label3"
Height = 255
Left = 960
TabIndex = 11
Top = 120
Width = 615
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "總字數:"
Height = 375
Left = 120
TabIndex = 4
Top = 120
Width = 735
End
Begin VB.Label Label1
BorderStyle = 1 'Fixed Single
Caption = "打字時間為15分鐘!"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 375
Left = 3840
TabIndex = 3
Top = 120
Width = 3015
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mm As Integer
Dim ss As Integer
Private curnlen As Integer
Private ylen As Integer
'Private zqcount As Integer
Private Sub Command1_Click()
Form4.Hide
Form2.Show
End Sub
Private Sub Form_Load()
'On Error GoTo err_sel
subCloseDisable Me.hwnd
subMaxDisable Me.hwnd
subMinDisable Me.hwnd
curnlen = 0
zqcount = 0
ylen = 0
Timer1.Enabled = True
mm = 15
ss = 0
Timer1.Interval = 1000
Dim ssearch1 As String
Randomize
u = Second(Timer) 'u存取隨機秒數
For i = 0 To u
st1 = Int(1 + Rnd() * 10)
Next i
If st1 = 10 Then
st = "C000" & st1
Else
st = "C0000" & st1
End If
RichTextBox1.Text = ""
RichTextBox2.Text = ""
Timer1.Interval = 1000
ssearch1 = "select * from 試題表 where st_no='" & st & "'"
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset
strcnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\soft113.mdb;Persist Security Info=False"
cnn.Open strcnn
rs.Open ssearch1, cnn
RichTextBox1.Text = rs!st_lr
rs.Close
cnn.Close
Dim zzs As Integer
zzs = Len(RichTextBox1.Text)
Label3.Caption = zzs
'err_sel:
'If Err.Number <> 0 Then
'MsgBox Err.Description
'Err.Clear
'End If
'If rs.State = adStateOpen Then
'rs.Close
'End If
'If cnn.State = adStateOpen Then
'cnn.Close
'End If
End Sub
Private Sub RichTextBox2_Change()
Dim u As Integer
Dim i As Integer
curnlen = Len(RichTextBox2.Text)
u = curnlen - ylen
If u > 0 Then
For i = ylen To curnlen - 1
RichTextBox1.SelStart = i
RichTextBox1.SelLength = 1
RichTextBox2.SelStart = i
RichTextBox2.SelLength = 1
If RichTextBox1.SelText = RichTextBox2.SelText Then
RichTextBox1.SelColor = vbBlue
dzcount = dzcount + 1 '統計正確字數
Else
RichTextBox1.SelColor = vbRed
End If
Next i
Else
RichTextBox1.SelStart = curnlen
RichTextBox1.SelLength = -u
RichTextBox1.SelColor = vbBlack
End If
ylen = curnlen
RichTextBox2.SelStart = curnlen
RichTextBox2.SelLength = 0
End Sub
Private Sub RichTextBox2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
End If
End Sub
Private Sub RichTextBox2_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 37 Or KeyCode = 39 Then
RichTextBox2.SelStart = Len(RichTextBox2.Text)
RichTextBox2.SelLength = 0
End If
End Sub
Private Sub RichTextBox2_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
RichTextBox2.SelStart = Len(RichTextBox2.Text)
RichTextBox2.SelLength = 0
End Sub
Private Sub Timer1_Timer()
If ss = 0 And mm > 0 Then
mm = mm - 1
ss = 60
End If
ss = ss - 1
Label7.Caption = mm
Label9.Caption = ss
If mm = 5 And ss = 0 Then
MsgBox "你還剩余五分鐘,你要加油哦!"
End If
If mm = 0 And ss = 0 Then
Timer1.Enabled = False
MsgBox "你的考試時間已到!"
RichTextBox2.Enabled = False
End If
End Sub
'統計正確字數
'Function comparetxt(string1 As String, string2 As String) As Single
'Dim i As Integer
'Dim a, b As String
'curnlen = Len(string2)
'If curnlen > 0 Then
'For i = ylen To curnlen
'a = Mid(string1, i, 1)
'b = Mid(string2, i, 1)
'If a = b Then zqcount = zqcount + 1
'Next
'comparetxt = Count
'ylen = curnlen + 1
'End If
'End Function
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -