发布网友 发布时间:2022-04-24 01:23
共1个回答
热心网友 时间:2022-05-05 01:11
去年做了一个。如果想要的话。留个邮箱吧。
下面是部分内容。
Option Explicit
Dim timu() As Integer
Dim da(), rda() As String
Dim ts As Integer
Dim fn As Integer
Private Sub Command1_Click()
Dim opt As Integer
If ts = 1 Then
MsgBox "已返回题目开始。"
Exit Sub
End If
For opt = Option1.LBound To Option1.UBound
If Option1(opt).Value Then Option1(opt).Value = False
Next
ts = ts - 1
Data1.Recordset.Move (timu(ts) - timu(ts + 1))
rda(ts) = Text2.Text
Label9.Caption = ts
End Sub
Private Sub Command2_Click()
Dim opt As Integer
If ts = Label4.Caption Then
MsgBox "题目已全部出完。"
Exit Sub
End If
For opt = Option1.LBound To Option1.UBound
If Option1(opt).Value Then Option1(opt).Value = False
Next
ts = ts + 1
Data1.Recordset.Move (timu(ts) - timu(ts - 1))
rda(ts) = Text2.Text
Label9.Caption = ts
End Sub
Private Sub Command3_Click()
Form2.Show
Unload Form3
End Sub
Private Sub Command4_Click()
Dim opt As Integer
Dim yn As Boolean
For opt = Option1.LBound To Option1.UBound
If Option1(opt).Value Then yn = True
Next
If yn Then
Label5.Caption = Text2.Text
Else
MsgBox "请你先选择答案!"
End If
End Sub
Private Sub Command5_Click()
Dim opt As Integer
Dim dyn As Integer
Dim vyn As Integer
If ts <> Label4.Caption Then
vyn = MsgBox("题目尚未答完,是否确定交卷?点击是交卷,点击否重新答题。", vbYesNo)
If vyn = vbNo Then Exit Sub
End If
For opt = 1 To ts
If da(opt) = rda(opt) Then dyn = dyn + 1
Next opt
MsgBox "已回答" + Str(ts) + "道问题,答对" + Str(dyn) + "道。"
End Sub
Private Sub Form_Activate()
Dim cy As Integer
Dim ccy As Integer
Dim ccn As Boolean
Dim drr As Integer
ReDim timu(1 To Label4.Caption)
ReDim da(1 To Label4.Caption)
ReDim rda(1 To Label4.Caption)
Data1.Recordset.MoveLast
drr = Data1.Recordset.RecordCount
Randomize
timu(1) = Int(drr * Rnd + 1)
For cy = 2 To Label4.Caption
timu(cy) = Int(drr * Rnd + 1)
Do
ccy = ccy + 1
If timu(cy) = timu(ccy) Then
timu(cy) = Int(drr * Rnd + 1)
ccy = 0
End If
If ccy = cy - 1 Then Exit Do
Loop
Next cy
Data1.Recordset.MoveFirst
ts = 1
Data1.Recordset.Move (timu(ts) - 1)
rda(1) = Text2.Text
Label9.Caption = ts
End Sub
Private Sub Form_Unload(Cancel As Integer)
Form3.Hide
Form2.Show
End Sub
Private Sub Option1_Click(Index As Integer)
da(ts) = Chr(Index + 65)
End Sub