⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 模拟驾驶员上机考试,实现单机自动随机出题,批卷,纠错.
💻 FRM
📖 第 1 页 / 共 4 页
字号:
Dim pmingti(1 To 35, 1 To 3) As String
Dim pdati(1 To 35) As String
Dim pcuoti(1 To 35) As String
Dim pdzs As Integer
Dim pct As Integer
Dim jj As Integer
Dim tp(1 To 50) As String
Dim tps As Integer
Dim xx As String
Dim yy As String
Dim tpzs As Integer
Dim tupian(1 To 1000) As String
Dim chakan As Integer
Dim ttime As Integer
Dim ttime1 As Integer
Dim ll As Integer
Dim ccc As Integer


Private Sub Form_KeyPress(KeyAscii As Integer)
Print KeyAscii
Select Case KeyAscii
   Case 49
     Label21_Click
   Case 50
     Label22_Click
   Case 51
     Label23_Click
   Case 52
     Label24_Click
   End Select
End Sub



Private Sub Label21_Click()
dati(Val(Label3)) = "A"
Label2 = "已选择--A"
If Label3 = 65 Then
Command18_Click
End If
Command7_Click
End Sub

Private Sub label16_Click()
ct = 0
For j = 1 To 65
  If InStr(dati(j), mingti(j, 6)) <> 0 Then
     fenshu = fenshu + 1
     Else
     ct = ct + 1
     cuoti(ct) = j
     End If
   Next
  'Label4 = "答错了--" & ct & "道题"
pct = 0
For j = 1 To 35
  If InStr(pdati(j), pmingti(j, 2)) <> 0 Then
     pfenshu = pfenshu + 1
     Else
     pct = pct + 1
     pcuoti(pct) = j
     End If
   Next
  Label4 = "共答错了--" & ct + pct & "道题"
  Label8 = "选择答错了--" & ct & "道题"
  Label9 = "判断答错了--" & pct & "道题"
  Label10 = "总共得分--" & fenshu + pfenshu
  pijuan1
  Timer1.Enabled = False
End Sub

Private Sub Command11_Click()
shengti
PB1.Visible = True
PB1.Value = 1
PB1.Max = 120
Command11.Enabled = False
i = 1
strtmp = ","
Set xlapp = CreateObject("Excel.Application") '创建Excel应用类
    xlapp.Visible = False '设置Excel可见
    Set xlbook = xlapp.Workbooks.Open(App.Path & "\mt\OTK.mmt") '打开Excel工作簿
    Set xlsheet = xlbook.Worksheets(1) '打开Excel工作表
    'xlsheet.Activate '激活工作表
    xzzs = 1448 'xlsheet.Cells(1, 8)
While i <= 65
Randomize
 strvalue = 1 + Int(Rnd * xzzs)
If InStr(strtmp, "," & strvalue & ",") = 0 Then  '比较所选数  验证 strtmp这个字符串中 有没有"," & strvalue & "," 这个字符串
   aa(i) = strvalue
  'Print strvalue
 strtmp = strtmp & strvalue & ","
'.......另外要做的操作
i = i + 1
End If
Wend
 DoEvents
For i = 1 To 65
    For j = 1 To 7
    mingti(i, j) = xlsheet.Cells(aa(i), j)
    Next
     DoEvents
     PB1.Value = i
     Label14 = i & "%"
Next
  xlapp.quit
  DoEvents
'MsgBox "  模拟考题已经生成,可以开始答卷了!", 64, "  提示"
i = 1
For i = 1 To 5
   Label1(i) = mingti(1, i)
   Next
If mingti(1, 7) <> "" Then
xiaotu (mingti(1, 1))
Image1.Picture = LoadPicture(App.Path & mingti(1, 7))
Else: Image1.Picture = LoadPicture(App.Path & "\90.jpg")
End If
Label2 = "未选择"
For i = 1 To 65
dati(i) = ""
Next
For i = 1 To 35
pdati(i) = ""
Next
'判断题================================================================
i = 1
strtmp = ","
Set xlapp = CreateObject("Excel.Application") '创建Excel应用类
    xlapp.Visible = False '设置Excel可见
    Set xlbook = xlapp.Workbooks.Open(App.Path & "\mt\TBK.orc") '打开Excel工作簿
    Set xlsheet = xlbook.Worksheets(1) '打开Excel工作表
    'xlsheet.Activate '激活工作表
    pdzs = xlsheet.Cells(1, 4)
While i <= 35
Randomize
 strvalue = 1 + Int(Rnd * pdzs)
If InStr(strtmp, "," & strvalue & ",") = 0 Then  '比较所选数  验证 strtmp这个字符串中 有没有"," & strvalue & "," 这个字符串
   bb(i) = strvalue
  'Print strvalue
 strtmp = strtmp & strvalue & ","
'.......另外要做的操作
i = i + 1
End If
Wend
 DoEvents
For i = 1 To 35
    For j = 1 To 3
    pmingti(i, j) = xlsheet.Cells(bb(i), j)
    Next
    PB1.Value = PB1.Value + 1
    Label14 = PB1.Value & "%"
Next
  xlapp.quit
  DoEvents
'  Print "ok"
Label3 = 1
'If MsgBox("  准备就绪是否开始计时答卷", 65, "  提示") = vbOK Then
Command11.Enabled = True
pijuan2
PB1.Value = 120
PB1.Visible = False
kkk
ttime = 0
ttime1 = 45
Label12 = ttime1
'-------
chushi
xuan
pijuan2
qie1
Label11 = ""
If ll = 0 Then
  Label2.Left = Label2.Left + Label1(1).Left
  Label3.Left = Label3.Left + Label1(1).Left
  Label5.Left = Label5.Left + Label1(1).Left
  'Label6.Left = Label6.Left + Label1(1).Left
  'Label7.Left = Label7.Left + Label1(1).Left
  Label11.Left = Label11.Left + Label1(1).Left
  Label12.Left = Label12.Left + Label1(1).Left
  ll = 1
  End If

'-------
Label12.Visible = True
   For i = 1 To 5
      Label1(i).Visible = False
      Next
End Sub
Private Sub mtzs()
 End Sub

Private Sub Command12_Click()
If chakan < tpzs Then
Image2.Picture = LoadPicture(App.Path & tupian(chakan + 1))
chakan = chakan + 1
Image2.Left = Command9.Width + 500
Image2.Top = 500
End If
End Sub

Private Sub Command13_Click()
If chakan > 1 Then
Image2.Picture = LoadPicture(App.Path & tupian(chakan - 1))
chakan = chakan - 1
Image2.Left = Command9.Width + 500
Image2.Top = 500
End If
End Sub

Private Sub Command14_Click()
For i = 1 To 64
   Label21_Click
  Next
End Sub

Private Sub Command35_Click()
Cls
End Sub

Private Sub Command16_Click()
For i = 1 To Text1 - 1
 Command26_Click
 Next
End Sub

Private Sub Command15_Click()
For i = 1 To 34
  Command19_Click
  Next
End Sub

Private Sub Command17_Click()
xuan
Label3 = 1
i = 1
For i = 1 To 5
   Label1(i) = mingti(1, i)
   Next
If mingti(1, 7) <> "" Then
xiaotu (mingti(1, 1))
Image1.Picture = LoadPicture(App.Path & mingti(1, 7))
Else: Image1.Picture = LoadPicture(App.Path & "\90.jpg")
End If
If dati(1) = "" Then
Label2 = "未选择"
Else
  Label2 = "已选择--" & dati(Val(Label3))
 End If
End Sub

Private Sub Command18_Click()
pan
i = 1
For i = 1 To 1
   Label1(i) = pmingti(1, i)
   Next
If pmingti(1, 3) <> "" Then
xiaotu (pmingti(1, 1))
Image1.Picture = LoadPicture(App.Path & pmingti(1, 3))
Else: Image1.Picture = LoadPicture(App.Path & "\90.jpg")
End If
If pdati(1) = "" Then
Label2 = "未判断"
Else
 If pdati(1) = "q" Then
    Label2 = "正确"
    Else
    Label2 = "错误"
    End If
 End If
Label3 = 66
End Sub

Private Sub Command19_Click()
pdati(Val(Label3 - 65)) = "q"
Label2 = "正确"
Command23_Click
End Sub

Private Sub Label22_Click()
dati(Val(Label3)) = "B"
Label2 = "已选择--B"
Command7_Click
If Label3 = 65 Then
'MsgBox "  65道考题已经全部答完,下面做选择题", 64, "  提示"
Command18_Click
End If
End Sub

Private Sub Command20_Click()
pdati(Val(Label3)) = "w"
Label2 = "错误"
Command23_Click
End Sub

Private Sub label33_click()
If Val(Label3) = 1 Then Exit Sub
Label3 = Str(Val(Label3) - 1)
i = 1
t = Val(Label3)
If t <= 35 Then
For i = 1 To 1
   Label1(i) = pmingti(t, i)
   Next
If pdati(Val(Label3)) <> "" Then
   If pdati(Val(Label3)) = q Then
     Label2 = "正确"
     Else: Label2 = "错误"
     End If
   Else
   Label2 = "未判断"
   End If
If pmingti(t, 3) <> "" Then
xiaotu (pmingti(t, 1))
Image1.Picture = LoadPicture(App.Path & pmingti(t, 3))
Else: Image1.Picture = LoadPicture(App.Path & "\90.jpg")
End If
End If
End Sub

Private Sub label34_click()
If Val(Label3) >= 35 Then Exit Sub
Label3 = Str(Val(Label3) + 1)
i = 1
t = Val(Label3)
If t <= 35 Then
For i = 1 To 1
   Label1(i) = pmingti(t, i)
   Next
If pdati(Val(Label3)) <> "" Then
   If pdati(Val(Label3)) = q Then
     Label2 = "正确"
     Else: Label2 = "错误"
     End If
   Else
   Label2 = "未判断"
   End If
If pmingti(t, 3) <> "" Then
xiaotu (pmingti(t, 1))
Image1.Picture = LoadPicture(App.Path & pmingti(t, 3))
Else: Image1.Picture = LoadPicture(App.Path & "\90.jpg")
End If
End If
End Sub

Private Sub Command23_Click()
For j = 1 To 35
  If pdati(j) = "" Then
    Label2 = "未判断"
    t = j
    Label3 = j + Label3 - 1
    For i = 1 To 1
   Label1(i) = pmingti(t, i)
   Next
   If pmingti(t, 3) <> "" Then
    'jiaozheng
    xiaotu (pmingti(t, 1))
    Image1.Picture = LoadPicture(App.Path & pmingti(t, 3))
    Else: Image1.Picture = LoadPicture(App.Path & "\90.jpg")
    End If
   Exit Sub
    MsgBox "  35道考题已经全部答完", 64, "  提示"
  End If
   Next
End Sub

Private Sub Command24_Click()
Dim pct As Integer
For j = 1 To 35
  If pdati(j) = pmingti(j, 2) Then
     pfenshu = pfenshu + 1
     Else
     pct = pct + 1
     pcuoti(pct) = j
     End If
   Next
  Label4 = "答错了--" & pct & "道题"
End Sub

Private Sub Command25_Click()
ii = 1
If ct = 0 Then Exit Sub
xuan
Command26.Enabled = True
Command28.Enabled = False
Label3 = cuoti(ii)
Label2 = "错误选择--" & dati(Label3)
Label11 = "正确答案--" & mingti(Label3, 6)
For i = 1 To 5
   Label1(i) = mingti(Label3, i)
   Next
   Label200 = 1
End Sub

Private Sub Command26_Click()
ii = ii + 1
 If ii > 65 Then Exit Sub
 If cuoti(ii) = "" Then Exit Sub
Label3 = cuoti(ii)
Label2 = "错误选择--" & dati(Label3)
Label11 = "正确答案--" & mingti(Label3, 6)
For i = 1 To 5
   Label1(i) = mingti(Label3, i)
   Next
If mingti(Label3, 7) <> "" Then
xiaotu (mingti(Label3, 1))
Image1.Picture = LoadPicture(App.Path & mingti(Label3, 7))
Else: Image1.Picture = LoadPicture(App.Path & "\90.jpg")
End If
   
   Label200 = Label200 + 1
End Sub

Private Sub Command27_Click()
jj = 1
If pct = 0 Then Exit Sub
pan
Command28.Enabled = True
Command26.Enabled = False
Label3 = pcuoti(jj)
If pdati(Label3) = "q" Then
  Label2 = "错误判断-对"
  Else
  lable2 = "错误判断--错"
  End If
If pmingti(Label3, 2) = "q" Then
  Label11 = "正确判断-对"
  Else
  Label11 = "正确判断--错"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -