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

📄 xzt.frm

📁 计算机考试、作为一个高职高专的毕业设计的内容。
💻 FRM
字号:
VERSION 5.00
Begin VB.Form form5 
   BackColor       =   &H00C0E0FF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "四方计算机考试系统-----选择题"
   ClientHeight    =   6270
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   9810
   FillColor       =   &H00FFFFFF&
   Icon            =   "Xzt.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6270
   ScaleWidth      =   9810
   StartUpPosition =   2  '屏幕中心
   Begin VB.CheckBox Check1 
      BackColor       =   &H00C0E0FF&
      Caption         =   "1"
      Height          =   250
      Index           =   0
      Left            =   360
      TabIndex        =   18
      Top             =   5400
      Width           =   500
   End
   Begin VB.Timer Timer2 
      Interval        =   30000
      Left            =   8160
      Top             =   0
   End
   Begin VB.Timer Timer1 
      Interval        =   1000
      Left            =   8640
      Top             =   0
   End
   Begin VB.ComboBox Combo1 
      BackColor       =   &H00C0E0FF&
      Height          =   300
      Left            =   8640
      TabIndex        =   15
      Text            =   "1"
      Top             =   1560
      Width           =   735
   End
   Begin VB.CommandButton Command4 
      BackColor       =   &H00FFC0C0&
      Caption         =   "最后一题"
      Height          =   450
      Left            =   4920
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   4750
      Width           =   1200
   End
   Begin VB.CommandButton Command3 
      BackColor       =   &H00FFC0C0&
      Caption         =   "下移一题"
      Height          =   450
      Left            =   3480
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   4750
      Width           =   1200
   End
   Begin VB.CommandButton Command2 
      BackColor       =   &H00FFC0C0&
      Caption         =   "上移一题"
      Height          =   450
      Left            =   2040
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   4750
      Width           =   1200
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00FFC0C0&
      Caption         =   "第一题"
      Height          =   450
      Left            =   600
      MaskColor       =   &H00C0E0FF&
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   4750
      Width           =   1200
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00C0E0FF&
      Height          =   3255
      Left            =   240
      TabIndex        =   5
      Top             =   1320
      Width           =   9255
      Begin VB.OptionButton Option1 
         BackColor       =   &H00C0E0FF&
         Caption         =   "  A、"
         Height          =   255
         Index           =   1
         Left            =   360
         TabIndex        =   14
         Top             =   570
         Width           =   915
      End
      Begin VB.OptionButton Option1 
         BackColor       =   &H00C0E0FF&
         Caption         =   "  B、"
         Height          =   255
         Index           =   2
         Left            =   360
         TabIndex        =   13
         Top             =   1283
         Width           =   800
      End
      Begin VB.OptionButton Option1 
         BackColor       =   &H00C0E0FF&
         Caption         =   "  C、"
         Height          =   255
         Index           =   3
         Left            =   360
         TabIndex        =   12
         Top             =   2093
         Width           =   855
      End
      Begin VB.OptionButton Option1 
         BackColor       =   &H00C0E0FF&
         Caption         =   "  D、"
         Height          =   255
         Index           =   4
         Left            =   360
         TabIndex        =   11
         Top             =   2843
         Width           =   800
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackColor       =   &H00C0E0FF&
         Caption         =   "Label2"
         Height          =   180
         Left            =   1320
         TabIndex        =   10
         Top             =   600
         Width           =   6900
         WordWrap        =   -1  'True
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         BackColor       =   &H00C0E0FF&
         Caption         =   "Label3"
         Height          =   180
         Left            =   1320
         TabIndex        =   9
         Top             =   1320
         Width           =   6900
         WordWrap        =   -1  'True
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         BackColor       =   &H00C0E0FF&
         Caption         =   "Label4"
         Height          =   180
         Left            =   1320
         TabIndex        =   8
         Top             =   2130
         Width           =   6900
         WordWrap        =   -1  'True
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         BackColor       =   &H00C0E0FF&
         Caption         =   "Label5"
         Height          =   180
         Left            =   1320
         TabIndex        =   7
         Top             =   2880
         Width           =   6900
         WordWrap        =   -1  'True
      End
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H00C0E0FF&
      Height          =   735
      Left            =   240
      TabIndex        =   6
      Top             =   4560
      Width           =   9255
      Begin VB.CommandButton Command6 
         BackColor       =   &H00FFC0C0&
         Caption         =   "交卷退出"
         Height          =   450
         Left            =   7560
         Style           =   1  'Graphical
         TabIndex        =   17
         Top             =   200
         Width           =   1095
      End
      Begin VB.CommandButton Command5 
         BackColor       =   &H00FFC0C0&
         Caption         =   "返回系统"
         Height          =   450
         Left            =   6120
         Style           =   1  'Graphical
         TabIndex        =   16
         Top             =   200
         Width           =   1095
      End
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H00C0E0FF&
      Caption         =   "Label1"
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   840
      Left            =   480
      TabIndex        =   0
      Top             =   360
      Width           =   8895
      WordWrap        =   -1  'True
   End
End
Attribute VB_Name = "form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Cn As New Connection
Dim rst1 As New ADODB.Recordset
Dim n As Integer
Dim i As Integer
Dim m1 As Integer
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST& = -1
' 将窗口置于列表顶部,并位于任何最顶部窗口的前面
Private Const SWP_NOSIZE& = &H1
' 保持窗口大小
Private Const SWP_NOMOVE& = &H2
' 保持窗口位置
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Integer, ByVal bRevert As Integer) As Integer
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Integer, ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer
Private Sub refreshform()
    n = rst1.AbsolutePosition                     '为后用MOVE方法相对移动位置作准备。
    Combo1.Text = rst1.AbsolutePosition
    If rst1.Fields("do").Value = False Then       '题目没有做过
       For i = 1 To 4
        Option1(i).Value = False                 '删除上一题遗留的答案
       Next i
    Else
        Option1(rst1.Fields("ksdan").Value) = True  '做过,显示本题答案
    End If
    'Label1.Caption = rst1.AbsolutePosition & "、 " & rst1.Fields("tkbh") & rst1.Fields("title")
    Label2.Caption = rst1.Fields("a").Value
    Label3.Caption = rst1.Fields("b").Value
    Label4.Caption = rst1.Fields("c").Value
    Label5.Caption = rst1.Fields("d").Value      '更新并显示题目
End Sub
Private Sub rstsave()
For i = 1 To 4
    If Option1(i).Value = True Then       '判断答案为第几个
        rst1.Fields("ksdan").Value = i     '将答案保存在字段dan中
        rst1.Fields("do").Value = True     '将本题做标志--已做过
        m1 = rst1.AbsolutePosition - 1
        Check1(m1).Value = Checked         '在界面上标志本题
        rst1.Update
    End If
Next i
End Sub
Private Sub Combo1_Click()
Call rst1save
rst1.Move (Combo1.Text - n)    '移至指定的题号,MOVE后数字是相对位置 combol为单击后combo1值,n为先前的combo1的值
Call refreshform
End Sub
Private Sub Command1_Click()
    Call rstsave
    rst1.MoveFirst
    Call refreshform
End Sub
Private Sub Command2_Click()
    Call rstsave
    rst1.MovePrevious
    If rst1.BOF Then
        rst1.MoveFirst
    End If
    Call refreshform
        End Sub
Private Sub Command3_Click()
   Call rstsave
   rst1.MoveNext
   If rst1.EOF Then
      rst1.MoveLast
   End If
   Call refreshform
End Sub
Private Sub Command4_Click()
 Call rstsave
 rst1.MoveLast
 Call refreshform
End Sub
Private Sub xztexit()
Call rstsave
n = 0
m1 = 0
sum = 0
rst1.MoveFirst1
For i = 0 To rst1.RecordCount - 1
    n = IIf(rst1.Fields("bzdan").Value = rst1.Fields("ksdan").Value, n + 1, n)    '做对 n 道题
    m1 = IIf(rst1.Fields("do") = False, m1 + 1, m1)                                 '未做 m 道题
    sum = IIf(rst1.Fields("bzdan").Value = rst1.Fields("ksdan").Value, sum + rst1.Fields("score"), sum)
    rst1.MoveNext
Next i

Set fso = CreateObject("Scripting.FileSystemObject")
Set myfile = fso.CreateTextFile(App.Path & "\testfile.txt", True)
myfile.writeline (zkzh)
myfile.writeline (bj)
myfile.writeline (xm)
myfile.writeline (time1)
myfile.writeline (sum)
myfile.writeline (ksdo)
myfile.Close

End Sub
Private Sub Command5_Click()
Call xztexit
rel = MsgBox("你的选择题还有 " & m1 & " 未做,你共有 " & n & " 道题做对,现在是否退出", vbDefaultButton2 + vbYesNo + vbInformation, "提示")
If rel = vbYes Then
    Unload Me
    Form2.Show
Else
    rst1.MoveFirst1
    Call refreshform
End If
End Sub

Private Sub Command6_Click()
    Call xztexit
    rel = MsgBox("你的选择题还有 " & m1 & " 未做,你共做对了 " & n & " 道题,你现在是否交卷", vbDefaultButton2 + vbYesNo + vbInformation, "提示")
    If rel = vbYes Then
        Call save
        Unload Me
        Form6.Show
    Else
        rst1.MoveFirst1
        Call refreshform
    End If
End Sub
Private Sub Form_Load()

SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
' 将窗口设为总在最前

Dim R As Integer

form5.Caption = "计算机考试系统--选择题  " + bj + "  准考证号:" + zkzh + "  " + xm + "   时间还有  " & Int((time1 - 1) / 60) & "分"

Cn.Open "Data Source=" & App.Path & "\kssj.mdb;Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database password=123456;"
rst1.Open "select top 20 title,a,b,c,d,bzdan,do,ksdan,score,tkbh,ksth  from xzt  where kstx='选择题' order by ksth asc", Cn, adOpenStatic, adLockOptimistic, c
If Not rst1.EOF() Then
    rst1.MoveFirst
    Call refreshform
    Check1(0).Top = 5450
    Check1(0).Left = 240
    Check1(0).Value = IIf(rst1.Fields("do") = True, Checked, Unchecked)
End If
For i = 1 To rst1.RecordCount - 1
    rst1.MoveNext
    Load Check1(i)
    Check1(i).Caption = i + 1
    Check1(i).Visible = True '显示新按钮
    Check1(i).Top = 5450 + Int(i / 15) * 200
    Check1(i).Left = 240 + Int(i Mod 15) * 630
    Check1(i).Value = IIf(rst1.Fields("do") = True, Checked, Unchecked)
    Combo1.AddItem (i)
    Next i
Combo1.AddItem (i)
'给已做过题目加上标志
rst1.MoveFirst
n = 1
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Set fso = Nothing
    Set myfile = Nothing
    rst1.Close
    Cn.Close
    Set Cn = Nothing
    Set rst1 = Nothing
End Sub
Private Sub Timer1_Timer()
If (time1 = 300) Then
    MsgBox "时间还剩余5分钟,请注意保存文件!", vbOKOnly + vbInformation, "提示"
End If
If (time1 = 0) Then
    Call xztexit
    Unload Me
    Form6.Show
    '将操作题结果保存在指定的位置,后上传至服务器!
Else
    time1 = time1 - 1
End If
End Sub
Private Sub Timer2_Timer()
Set fso = CreateObject("Scripting.FileSystemObject")
Set myfile = fso.CreateTextFile(App.Path & "\testfile.txt", True)
myfile.writeline (zkzh)
myfile.writeline (bj)
myfile.writeline (xm)
myfile.writeline (time1)
myfile.writeline (sum)
myfile.writeline (ksdo)
form5.Caption = "计算机考试系统--选择题  " + bj + "  准考证号:" + zkzh + "  " + xm + "   时间还剩:  " & Int(time1 / 60) & "分"
myfile.Close
End Sub

⌨️ 快捷键说明

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