📄 frmtest.frm
字号:
VERSION 5.00
Begin VB.Form FrmSelectTest
BackColor = &H00808080&
BorderStyle = 0 'None
Caption = "单选题"
ClientHeight = 8265
ClientLeft = 0
ClientTop = 0
ClientWidth = 10740
LinkTopic = "Form1"
ScaleHeight = 8265
ScaleWidth = 10740
StartUpPosition = 1 '所有者中心
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "F:\My Documents\VB\考试管理系统\examktl.dll"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 4545
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "ChoiceExercise"
Top = 7425
Visible = 0 'False
Width = 2085
End
Begin VB.CommandButton Command2
Caption = "最后"
Height = 330
Index = 3
Left = 6480
TabIndex = 13
Top = 6795
Width = 1140
End
Begin VB.CommandButton Command2
Caption = "下一题"
Height = 330
Index = 2
Left = 5355
TabIndex = 12
Top = 6795
Width = 1140
End
Begin VB.CommandButton Command2
Caption = "上一题"
Height = 330
Index = 1
Left = 4230
TabIndex = 11
Top = 6795
Width = 1140
End
Begin VB.CommandButton Command2
Caption = "第一题"
Height = 330
Index = 0
Left = 3105
TabIndex = 10
Top = 6795
Width = 1140
End
Begin VB.CommandButton Command1
Caption = "做好了"
Height = 330
Left = 8550
TabIndex = 8
Top = 6795
Width = 1410
End
Begin VB.Frame Frame3
BackColor = &H00808080&
BorderStyle = 0 'None
Height = 5145
Left = 495
TabIndex = 2
Top = 1305
Width = 9690
Begin VB.OptionButton Option1
BackColor = &H00808080&
Caption = "D"
ForeColor = &H00FFFF00&
Height = 645
Index = 4
Left = 1170
TabIndex = 14
Top = 3690
Width = 6990
End
Begin VB.OptionButton Option1
BackColor = &H00808080&
Caption = "C"
ForeColor = &H00FFFF00&
Height = 645
Index = 3
Left = 1170
TabIndex = 7
Top = 2790
Width = 6990
End
Begin VB.OptionButton Option1
BackColor = &H00808080&
Caption = "B"
ForeColor = &H00FFFF00&
Height = 645
Index = 2
Left = 1170
TabIndex = 6
Top = 1980
Width = 6990
End
Begin VB.OptionButton Option1
BackColor = &H00808080&
Caption = "A"
ForeColor = &H00FFFF00&
Height = 645
Index = 1
Left = 1170
TabIndex = 5
Top = 1125
Width = 6990
End
Begin VB.OptionButton Option1
BackColor = &H00808080&
ForeColor = &H00FFFF00&
Height = 645
Index = 0
Left = 360
TabIndex = 4
Top = 4275
Visible = 0 'False
Width = 30
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "第1题目"
DataField = "Subject"
DataSource = "Data1"
ForeColor = &H00FFFF00&
Height = 870
Left = 630
TabIndex = 3
Top = 180
Width = 8070
End
End
Begin VB.Frame Frame2
Height = 60
Left = 45
TabIndex = 1
Top = 6615
Width = 10680
End
Begin VB.Frame Frame1
Height = 60
Left = 45
TabIndex = 0
Top = 1080
Width = 10680
End
Begin VB.Label Label4
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "×"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H008080FF&
Height = 240
Left = 10395
MouseIcon = "FrmTest.frx":0000
TabIndex = 16
Top = 80
Width = 240
End
Begin VB.Shape Shape2
BorderColor = &H00C0C0FF&
Height = 285
Left = 10350
Top = 35
Width = 330
End
Begin VB.Label Label3
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "Label3"
ForeColor = &H00C0FFFF&
Height = 285
Left = 135
TabIndex = 15
Top = 765
Width = 1140
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "单 选 题"
Height = 240
Left = 3150
TabIndex = 9
Top = 90
Width = 4020
End
Begin VB.Shape Shape1
BackColor = &H0000FFFF&
BackStyle = 1 'Opaque
BorderColor = &H0000FFFF&
Height = 330
Left = 0
Top = 0
Width = 10725
End
Begin VB.Line Line4
BorderColor = &H0080FFFF&
X1 = 0
X2 = 10710
Y1 = 8235
Y2 = 8235
End
Begin VB.Line Line3
BorderColor = &H0080FFFF&
X1 = 10710
X2 = 10710
Y1 = 0
Y2 = 8280
End
Begin VB.Line Line1
BorderColor = &H0000FFFF&
X1 = 0
X2 = 0
Y1 = 0
Y2 = 8235
End
End
Attribute VB_Name = "FrmSelectTest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Rs As ADODB.Recordset
Dim Msg$
Dim SQL$
Dim CurrentT As Integer
Public TWForm As New TransWindow
Private Sub Command1_Click()
TWForm.UnLoadForm
Me.Hide
End Sub
Private Sub Command2_Click(Index As Integer)
Select Case Index
Case 0
CurrentT = 0
Case 1
CurrentT = CurrentT - 1
If CurrentT < 0 Then: CurrentT = 0
Case 2
CurrentT = CurrentT + 1
If CurrentT >= SingleChoiceSubjectCount Then: CurrentT = SingleChoiceSubjectCount - 1
Case 3
CurrentT = SingleChoiceSubjectCount - 1
End Select
ViewSubject CurrentT
End Sub
Private Sub Form_Activate()
ViewSubject CurrentT
End Sub
Private Sub Form_Load()
TWForm.SetForm Me
Data1.DatabaseName = App.Path & "\examktl.dll"
Call Init
CurrentT = 0
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label4.ForeColor = &H8080FF
Shape2.BorderColor = &HC0C0FF
Label4.MousePointer = 0
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
TWForm.UnLoadForm
Set TWForm = Nothing
End Sub
Private Sub Label4_Click()
Me.WindowState = 1
End Sub
Private Sub Label4_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label4.ForeColor = vbRed
Shape2.BorderColor = vbRed
Label4.MousePointer = 99
End Sub
Private Sub Option1_Click(Index As Integer)
Dim sAnswer$
Select Case Index
Case 1
sAnswer = "A"
Case 2
sAnswer = "B"
Case 3
sAnswer = "C"
Case 4
sAnswer = "D"
Case Else
Exit Sub
End Select
SelectAnswer sAnswer, Index
End Sub
Sub ViewSubject(SubjectIndex As Integer)
On Error Resume Next
Label3.Caption = "第 " & SubjectIndex + 1 & " 题"
Option1(0).Value = True
SubjectMove SingleChoiceSubject(SubjectIndex)
Label2.Caption = Data1.Recordset.Fields(0)
Option1(1).Caption = Data1.Recordset.Fields(1)
Option1(2).Caption = Data1.Recordset.Fields(2)
Option1(3).Caption = Data1.Recordset.Fields(3)
Option1(4).Caption = Data1.Recordset.Fields(4)
Select Case SingleSelectQuestion(SubjectIndex)
Case "A"
Option1(1).Value = True
' SelectAnswer Data1.Recordset.Fields(5), 1
Case "B"
Option1(2).Value = True
' SelectAnswer Data1.Recordset.Fields(5), 2
Case "C"
Option1(3).Value = True
' SelectAnswer Data1.Recordset.Fields(5), 3
Case "D"
Option1(4).Value = True
' SelectAnswer Data1.Recordset.Fields(5), 4
End Select
End Sub
Sub SelectAnswer(Answer As String, AnswerIndex As Integer)
'SubjectMove SingleSelectSubject(CurrentT)
Data1.Recordset.Edit
Data1.Recordset.Fields(5) = Answer
Data1.UpdateRecord
If AnswerIndex = 0 Then: Exit Sub
SingleSelectQuestion(CurrentT) = Answer
End Sub
Sub Init()
On Error Resume Next
For i = 0 To UBound(SingleChoiceSubject)
SubjectMove SingleChoiceSubject(i)
SingleSelectQuestion(i) = Data1.Recordset.Fields(5)
SingleRightQuestion(i) = JieMi(Data1.Recordset.Fields(6), Data1.Recordset("key"))
Combo1.AddItem "第" & i & "题"
Next i
End Sub
Sub SubjectMove(SubjectIndexR As Long)
Data1.Refresh
Data1.Recordset.MoveFirst
Data1.Recordset.Move SubjectIndexR
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -