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

📄 control.frm

📁 计算机考试、作为一个高职高专的毕业设计的内容。
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form2 
   BackColor       =   &H00C0C0C0&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "四方考试系统--请选择相应的题型"
   ClientHeight    =   4050
   ClientLeft      =   2670
   ClientTop       =   2550
   ClientWidth     =   7815
   Icon            =   "control.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4050
   ScaleWidth      =   7815
   StartUpPosition =   2  '屏幕中心
   Begin VB.Timer Timer2 
      Interval        =   60000
      Left            =   6480
      Top             =   120
   End
   Begin VB.Timer Timer1 
      Interval        =   1000
      Left            =   7080
      Top             =   120
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H00C0C0C0&
      Height          =   615
      Left            =   240
      TabIndex        =   0
      Top             =   2760
      Width           =   4695
      Begin VB.Label Label5 
         BackColor       =   &H00C0C0C0&
         Caption         =   "Label5"
         Height          =   255
         Left            =   3600
         TabIndex        =   7
         Top             =   240
         Width           =   975
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         BackColor       =   &H00C0C0C0&
         Caption         =   "Label3"
         Height          =   180
         Left            =   1680
         TabIndex        =   6
         Top             =   240
         Width           =   540
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackColor       =   &H00C0C0C0&
         Caption         =   "Label2"
         Height          =   180
         Left            =   120
         TabIndex        =   5
         Top             =   240
         Width           =   540
      End
      Begin VB.Label Label4 
         BackColor       =   &H00C0C0C0&
         Caption         =   "Label4"
         Height          =   255
         Left            =   3000
         TabIndex        =   4
         Top             =   240
         Width           =   735
      End
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00C0C0C0&
      Height          =   2415
      Left            =   5160
      TabIndex        =   1
      Top             =   720
      Width           =   2415
      Begin VB.CommandButton Command2 
         BackColor       =   &H00C0C0C0&
         Caption         =   "WORD"
         Height          =   405
         Left            =   1320
         Style           =   1  'Graphical
         TabIndex        =   12
         Top             =   480
         Width           =   975
      End
      Begin VB.CommandButton Command6 
         BackColor       =   &H00C0C0C0&
         Caption         =   "交卷退出"
         Height          =   405
         Left            =   1320
         Style           =   1  'Graphical
         TabIndex        =   11
         Top             =   1680
         Width           =   975
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00C0C0C0&
         Caption         =   "理论题"
         Height          =   405
         Left            =   120
         Style           =   1  'Graphical
         TabIndex        =   10
         Top             =   480
         Width           =   1095
      End
      Begin VB.CommandButton Command5 
         BackColor       =   &H00C0C0C0&
         Caption         =   "POWERPOINT"
         Height          =   405
         Left            =   120
         Style           =   1  'Graphical
         TabIndex        =   9
         Top             =   1680
         Width           =   1095
      End
      Begin VB.CommandButton Command3 
         BackColor       =   &H00C0C0C0&
         Caption         =   "FRONTPAGE"
         Height          =   405
         Left            =   120
         Style           =   1  'Graphical
         TabIndex        =   8
         Top             =   1080
         Width           =   1095
      End
      Begin VB.CommandButton Command4 
         BackColor       =   &H00C0C0C0&
         Caption         =   "EXCEL"
         Height          =   405
         Left            =   1320
         Style           =   1  'Graphical
         TabIndex        =   3
         Top             =   1080
         Width           =   975
      End
   End
   Begin VB.Line Line2 
      BorderColor     =   &H008080FF&
      X1              =   120
      X2              =   7680
      Y1              =   600
      Y2              =   600
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H00C0C0C0&
      Caption         =   "考试系统"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   36
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00404040&
      Height          =   720
      Left            =   960
      TabIndex        =   2
      Top             =   960
      Width           =   2955
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
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
Dim Cn As New ADODB.Connection
Dim Rst As New ADODB.Recordset
Private Sub Command1_Click()
If ksdo = 0 Then
    Call rndrst    '未生成随机考试试卷,现在开始生成
End If
form5.Show
Unload Me
End Sub
Private Sub Command2_Click()
Rst.Open "select cztitle,cztx  from  czt  where cztx='word'", Cn, adOpenStatic, adLockOptimistic
If Not Rst.EOF() Then
    Form4.StatusBar1.Panels(1).Text = "当前考试类型:Word基本操作"
    Form4.RTfdata.Text = Rst.Fields("cztitle")
    Unload Me
    Form4.Show
    Form3.Show
Else
    MsgBox "考试试卷无题,请监考老师重新发卷!"
    Rst.Close
End If
End Sub

Private Sub Command3_Click()
Rst.Open "select cztitle,cztx  from  czt  where cztx='frontgpage'", Cn, adOpenStatic, adLockOptimistic
If Not Rst.EOF() Then
    Form4.StatusBar1.Panels(1).Text = "当前考试类型:frontpage基本操作"
    Form4.RTfdata.Text = Rst.Fields("cztitle")
    Unload Me
    Form4.Show
    Form3.Show
Else
    MsgBox "考试试卷无题,请监考老师重新发卷!"
    Rst.Close
End If
End Sub

Private Sub Command4_Click()
Rst.Open "select cztitle,cztx  from  czt  where cztx='excel'", Cn, adOpenStatic, adLockOptimistic
If Not Rst.EOF() Then
    Form4.RTfdata.Text = Rst.Fields("cztitle")
    Form4.StatusBar1.Panels(1).Text = "当前考试类型:excel基本操作"
    Unload Me
    Form4.Show
    Form3.Show
Else
    MsgBox "考试试卷无题,请监考老师重新发卷!"
    Rst.Close
End If
End Sub

Private Sub Command5_Click()
Rst.Open "select cztitle,cztx  from  czt  where cztx='powerpoint'", Cn, adOpenStatic, adLockOptimistic
If Not Rst.EOF() Then
    Form4.StatusBar1.Panels(1).Text = "当前考试类型:PowerPoint基本操作"
    Form4.RTfdata.Text = Rst.Fields("cztitle")
    Unload Me
    Form4.Show
    Form3.Show
Else
    MsgBox "考试试卷无题,请监考老师重新发卷!"
    Rst.Close
End If
End Sub
Private Sub Command6_Click()
rep = MsgBox("是否真的要交卷,如交卷按“是”,否则按“否”返回主题板", vbDefaultButton2 + vbYesNo + vbInformation, "时间提示")
If rep = vbYes Then
    Call save   '保存操作题文件,后交卷
    Unload Me
    Form6.Show
End If
End Sub

Private Sub Form_Load()

 Cn.Open "Data Source=" & App.Path & "\kssj.mdb;Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database password=123456;"
 Label2.Caption = "准考证号: " + zkzh
 Label3.Caption = bj
 Label4.Caption = xm
 Label5.Caption = "时间: " & Int(time1 / 60) & "分"
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set fso = Nothing
Set myfile = Nothing
Set Cn = Nothing
Set Rst = Nothing

End Sub
Private Sub Timer1_Timer()  '为考试时间的倒计时
If (time1 = 300) Then
    MsgBox "时间还剩余5分钟,请注意保存文件!", vbOKOnly + vbInformation, "提示"
End If
If (time1 = 0) Then
    Call save         '将操作题结果保存在指定的位置,后上传至服务器!
    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)
Label7.Caption = "时间  " & Int(time1 / 60) & "分"
myfile.Close
End Sub
Private Sub rndrst()        '生成随机试卷
Dim x As Integer
Dim pid As Integer
Dim rst1 As New ADODB.Recordset
Dim m() As Integer

pid = 20
rst1.Open "select ksth,title,a,b,c,d,bzdan,do,ksdan,score from xzt  where kstx='选择题'", Cn, adOpenStatic, adLockOptimistic
'adOpenStatic --静态游标。可以用来查找数据或生成报告的记录集合的静态副本
'adLockOptimistic--开放式记录锁定(逐条)。只在调用Update方法时锁定记录
c1 = ""
rst1.MoveFirst
For i = 1 To rst1.RecordCount - 1
    rst1.Fields("ksth") = 999              '初始化题号
    rst1.MoveNext
Next i
rst1.Fields("ksth") = 999
rst1.MoveFirst
ReDim m(rst1.RecordCount)
For i = 1 To pid
   Randomize
   x = Fix(Rnd * rst1.RecordCount) + 1
   If Not InStr(1, c1, x, 1) > 0 Then
   '从第1个字符开始,以文本比较的方式找起,小写和大写在文本比较下是一样的。
      c1 = c1 & x & ","
      m(i) = x
   Else
      i = i - 1
   End If
Next i
i = 1
rst1.Move m(1) - 1
For i = 1 To pid
    rst1.Fields("ksth") = i           '重新编排题号
    rst1.Move m(i + 1) - m(i)
Next i
Set rst1 = Nothing
ksdo = 1
End Sub

⌨️ 快捷键说明

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