www.pudn.com > xj1.rar > Form5.frm, change:2008-06-02,size:19610b


VERSION 5.00 
Begin VB.Form Form5  
   Caption         =   "实验考试系统" 
   ClientHeight    =   8850 
   ClientLeft      =   3015 
   ClientTop       =   1725 
   ClientWidth     =   9060 
   LinkTopic       =   "Form5" 
   MaxButton       =   0   'False 
   ScaleHeight     =   8850 
   ScaleWidth      =   9060 
   StartUpPosition =   2  '屏幕中心 
   Begin VB.Timer Timer1  
      Left            =   6720 
      Top             =   120 
   End 
   Begin VB.CommandButton Command2  
      Caption         =   "退出" 
      Height          =   495 
      Left            =   4680 
      TabIndex        =   33 
      Top             =   6840 
      Width           =   975 
   End 
   Begin VB.Timer Timer2  
      Interval        =   1000 
      Left            =   7560 
      Top             =   120 
   End 
   Begin VB.Frame Frame1  
      Height          =   6015 
      Left            =   120 
      TabIndex        =   17 
      Top             =   720 
      Width           =   7215 
      Begin VB.Label Label1  
         AutoSize        =   -1  'True 
         Caption         =   "Label1" 
         Height          =   180 
         Index           =   0 
         Left            =   120 
         TabIndex        =   27 
         Top             =   120 
         Width           =   540 
      End 
      Begin VB.Label Label1  
         AutoSize        =   -1  'True 
         Caption         =   "Label1" 
         Height          =   180 
         Index           =   1 
         Left            =   120 
         TabIndex        =   26 
         Top             =   720 
         Width           =   540 
      End 
      Begin VB.Label Label1  
         AutoSize        =   -1  'True 
         Caption         =   "Label1" 
         Height          =   180 
         Index           =   2 
         Left            =   120 
         TabIndex        =   25 
         Top             =   1320 
         Width           =   540 
      End 
      Begin VB.Label Label1  
         AutoSize        =   -1  'True 
         Caption         =   "Label1" 
         Height          =   180 
         Index           =   3 
         Left            =   120 
         TabIndex        =   24 
         Top             =   1920 
         Width           =   540 
      End 
      Begin VB.Label Label1  
         AutoSize        =   -1  'True 
         Caption         =   "Label1" 
         Height          =   180 
         Index           =   4 
         Left            =   120 
         TabIndex        =   23 
         Top             =   2520 
         Width           =   540 
      End 
      Begin VB.Label Label1  
         AutoSize        =   -1  'True 
         Caption         =   "Label1" 
         Height          =   180 
         Index           =   5 
         Left            =   120 
         TabIndex        =   22 
         Top             =   3120 
         Width           =   540 
      End 
      Begin VB.Label Label1  
         AutoSize        =   -1  'True 
         Caption         =   "Label1" 
         Height          =   180 
         Index           =   6 
         Left            =   120 
         TabIndex        =   21 
         Top             =   3720 
         Width           =   540 
      End 
      Begin VB.Label Label1  
         AutoSize        =   -1  'True 
         Caption         =   "Label1" 
         Height          =   180 
         Index           =   7 
         Left            =   120 
         TabIndex        =   20 
         Top             =   4320 
         Width           =   540 
      End 
      Begin VB.Label Label1  
         AutoSize        =   -1  'True 
         Caption         =   "Label1" 
         Height          =   180 
         Index           =   8 
         Left            =   120 
         TabIndex        =   19 
         Top             =   4920 
         Width           =   540 
      End 
      Begin VB.Label Label1  
         AutoSize        =   -1  'True 
         Caption         =   "Label1" 
         Height          =   180 
         Index           =   9 
         Left            =   120 
         TabIndex        =   18 
         Top             =   5520 
         Width           =   540 
      End 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "交卷" 
      Height          =   495 
      Left            =   2520 
      TabIndex        =   10 
      Top             =   6840 
      Width           =   1215 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   9 
      Left            =   7320 
      TabIndex        =   9 
      Top             =   6240 
      Width           =   1455 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   8 
      Left            =   7320 
      TabIndex        =   8 
      Top             =   5640 
      Width           =   1455 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   7 
      Left            =   7320 
      TabIndex        =   7 
      Top             =   5040 
      Width           =   1455 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   6 
      Left            =   7320 
      TabIndex        =   6 
      Top             =   4440 
      Width           =   1455 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   5 
      Left            =   7320 
      TabIndex        =   5 
      Top             =   3840 
      Width           =   1455 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   4 
      Left            =   7320 
      TabIndex        =   4 
      Top             =   3240 
      Width           =   1455 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   3 
      Left            =   7320 
      TabIndex        =   3 
      Top             =   2640 
      Width           =   1455 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   2 
      Left            =   7320 
      TabIndex        =   2 
      Top             =   2040 
      Width           =   1455 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   1 
      Left            =   7320 
      TabIndex        =   1 
      Top             =   1440 
      Width           =   1455 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   0 
      Left            =   7320 
      TabIndex        =   0 
      Top             =   840 
      Width           =   1455 
   End 
   Begin VB.Label Label2  
      Caption         =   "剩余时间" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   12 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H00FFFF00& 
      Height          =   255 
      Index           =   3 
      Left            =   4920 
      TabIndex        =   32 
      Top             =   8280 
      Width           =   1095 
   End 
   Begin VB.Label Label1  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   12 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H000000FF& 
      Height          =   375 
      Index           =   13 
      Left            =   6120 
      TabIndex        =   31 
      Top             =   8280 
      Width           =   1455 
   End 
   Begin VB.Label Label5  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   14.25 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H000000FF& 
      Height          =   495 
      Left            =   3720 
      TabIndex        =   30 
      Top             =   120 
      Width           =   2295 
   End 
   Begin VB.Label Label4  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   14.25 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H000000FF& 
      Height          =   495 
      Left            =   840 
      TabIndex        =   29 
      Top             =   120 
      Width           =   1935 
   End 
   Begin VB.Label Label3  
      AutoSize        =   -1  'True 
      Height          =   180 
      Left            =   720 
      TabIndex        =   28 
      Top             =   6840 
      Visible         =   0   'False 
      Width           =   90 
   End 
   Begin VB.Label Label1  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   12 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H000000FF& 
      Height          =   375 
      Index           =   12 
      Left            =   2160 
      TabIndex        =   16 
      Top             =   7560 
      Width           =   1575 
   End 
   Begin VB.Label Label1  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   12 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H000000FF& 
      Height          =   375 
      Index           =   11 
      Left            =   2160 
      TabIndex        =   15 
      Top             =   8280 
      Width           =   1455 
   End 
   Begin VB.Label Label1  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   12 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H000000FF& 
      Height          =   495 
      Index           =   10 
      Left            =   6120 
      TabIndex        =   14 
      Top             =   7560 
      Width           =   1575 
   End 
   Begin VB.Label Label2  
      Caption         =   "结束时间" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   12 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H00FFFF00& 
      Height          =   255 
      Index           =   1 
      Left            =   1080 
      TabIndex        =   13 
      Top             =   8280 
      Width           =   1095 
   End 
   Begin VB.Label Label2  
      Caption         =   "现在时间" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   12 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H00FFFF00& 
      Height          =   255 
      Index           =   2 
      Left            =   4920 
      TabIndex        =   12 
      Top             =   7560 
      Width           =   1095 
   End 
   Begin VB.Label Label2  
      Caption         =   "开始时间" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   12 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H00FFFF00& 
      Height          =   255 
      Index           =   0 
      Left            =   1080 
      TabIndex        =   11 
      Top             =   7560 
      Width           =   1095 
   End 
   Begin VB.Menu file  
      Caption         =   "文件(&F)" 
      Begin VB.Menu unlogin  
         Caption         =   "注消登录" 
      End 
      Begin VB.Menu creat  
         Caption         =   "创建试题库" 
         Enabled         =   0   'False 
      End 
      Begin VB.Menu a  
         Caption         =   "-" 
      End 
      Begin VB.Menu exit  
         Caption         =   "退出" 
      End 
   End 
   Begin VB.Menu show  
      Caption         =   "显示(&A)" 
      Begin VB.Menu time  
         Caption         =   "系统时间" 
         Enabled         =   0   'False 
      End 
      Begin VB.Menu an  
         Caption         =   "-" 
      End 
      Begin VB.Menu daima  
         Caption         =   "源代码" 
         Begin VB.Menu local  
            Caption         =   "当前窗口" 
         End 
         Begin VB.Menu all  
            Caption         =   "所有窗口" 
         End 
      End 
   End 
   Begin VB.Menu cx  
      Caption         =   "查询(&C)" 
      Begin VB.Menu xinxi  
         Caption         =   "个人信息" 
      End 
      Begin VB.Menu cxcj  
         Caption         =   "查询成绩" 
      End 
   End 
   Begin VB.Menu shuoming  
      Caption         =   "说明(&S)" 
      Begin VB.Menu html  
         Caption         =   "网页说明" 
      End 
      Begin VB.Menu txt  
         Caption         =   "文本说明" 
      End 
   End 
   Begin VB.Menu help  
      Caption         =   "帮助(&H)" 
   End 
End 
Attribute VB_Name = "Form5" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Dim rec As Xuezhe 
Dim rec1 As tiaokong 
Dim buf(1 To 10), buf1(1 To 10) As String * 20 
Dim bn(1 To 10), bn1(1 To 10) As String 
Dim kaosheng  As people 
 
Private Sub all_Click() 
Call duma 
End Sub 
 
Private Sub Command1_Click() 
'得到学号 
xuehao = Right(Label5.Caption, 6) 
'计算得分 
score = Val(Label3.Caption) 
For i = 0 To 9 
buf1(i + 1) = Text1(i).text 
If buf(i + 1) = buf1(i + 1) Then 
score = score + 5 
End If 
Next i 
Close #8, #9 
MsgBox "本次考试的得分是" + Str(score), vbInformation, "实验考试系统" 
 
 
 
'将成绩保存到考年个人信息文件中 
On Error GoTo err 
Open "data\ksxx.dat" For Random As #13 Len = Len(kaosheng) 
Open "data\ksxx.tmp" For Random As #14 Len = Len(kaosheng) 
For i = 1 To LOF(13) \ Len(kaosheng) 
Get #13, i, kaosheng 
If Val(kaosheng.xuehao) = Val(xuehao) Then 
kaosheng.score = score 
 
End If 
Put #14, , kaosheng 
Next i 
Close #13, #14 
Kill "data\ksxx.dat" 
Name "data\ksxx.tmp" As "data\ksxx.dat" 
'保存试题到网页 
Open "data\考试试题.html" For Output As #7 
Open "data\answer.tmp" For Input As #8 Len = 1 
Open "data\answer.tmp1" For Input As #9 Len = 1 
Print #7, "<html><head><title>考试试题</title></head><body><left><H2><font color=#0000ff>本次考试所有题目及答案<br><br><br>" 
For i = 0 To 9 
Line Input #8, bn(i + 1) 
Line Input #9, bn1(i + 1) 
Print #7, Form4.Label3(i).Caption + "<br>" + RTrim(Form4.Option1(i * 4).Caption) + "   "; '截短一行代码的长度 
Print #7, RTrim(Form4.Option1(i * 4 + 1).Caption) + "<br>" + RTrim(Form4.Option1(i * 4 + 2).Caption); 
Print #7, "   " + RTrim(Form4.Option1(i * 4 + 3).Caption) + "<br>"; 
Print #7, "你做的答案是:" + bn(i + 1) + "<br>" + "参考的答案是:" + bn1(i + 1) + "<br>" 
Next i 
For i = 0 To 9 
Print #7, Label1(i).Caption + "<br>" + "你做的答案是:" + Trim(Text1(i).text) + "<br>" + "参考的答案是:" + Trim(buf(i + 1)) + "<br>" 
Next i 
Print #7, , "</font></left></body></html>" 
Close #8, #9 
Kill "data\answer.tmp" 
Kill "data\answer.tmp1" 
'调用默认浏器,打开保存的试题 
For i = 0 To 30000 
Next i 
Dim Result 
Result = ShellExecute(0, vbNullString, "data\考试试题.html", vbNullString, vbNullString, SW_SHOWNORMAL) 
If Result <= 32 Then 
MsgBox "调用浏览器错误!", vbOKOnly + vbCritical, "错误:", 0 
End If 
err: 
If err.Number = 70 Then 
MsgBox "保存考试成绩失败,请确认磁盘是否写保护或写满!" 
MsgBox "保存考试试题失败,请确认磁盘是否写保护或写满!" 
End If 
 
Unload Form4 
End 
End Sub 
 
 
Private Sub Command2_Click() 
If MsgBox("确认退出考试,若退出本次考试将无效?", vbOKCancel, "实验考试系统") = vbOK Then 
Kill "data\answer.tmp" 
Kill "data\answer.tmp1" 
End 
Else 
Cancel = 1 
End If 
End Sub 
 
Private Sub cxcj_Click() 
Call xinxi_Click 
Form2.Label6.ForeColor = vbRed 
End Sub 
 
Private Sub exit_Click() 
Call Command2_Click 
End Sub 
 
Private Sub Form_Load() 
 
Dim time, time2 As String 
Dim time1 As String 
Dim h, m, s As Integer 
Static score As Integer 
'读入填空题到窗体上,并保存答案到临时文件数组中 
On Error GoTo err 
Dim ti(0 To 9) As Integer 
Dim tmp As String * 20 
Randomize 
Open "data\shiti2.dat" For Random As #6 Len = Len(rec1) 
'读入随机填空题 
For i = 0 To 9 
ti(i) = Int(Rnd * (LOF(6) / Len(rec1))) + 1 
Get #6, ti(i), rec1 
Label1(i) = Str(i + 11) + ". " + rec1.Question1 
buf(i + 1) = rec1.answer1 
Next i 
Close #6 
err: 
If err.Number = 53 Then 
MsgBox "试题库文件不存在,可能被移动或删除", vbInformation, "实验考试系统" 
End 
End If 
End Sub 
 
 
  
  
 
 
 
Private Sub Form_Unload(Cancel As Integer) 
'关闭窗口 
If MsgBox("确认退出考试,若退出本次考试将无效?", vbOKCancel, "实验考试系统") = vbOK Then 
Kill "data\answer.tmp" 
Kill "data\answer.tmp1" 
End 
Else 
Cancel = 1 
End If 
End Sub 
 
Private Sub help_Click() 
MsgBox "无可用帮助,请见使用说明!", vbOKOnly, "实验考试系统" 
End Sub 
 
Private Sub html_Click() 
'调用浏览器打开使用说明页面 
Call shoum1 
End Sub 
 
Private Sub local_Click() 
'当前窗口代码 
FForm7.show 
Form7.Label2.Caption = "data\form5.dat" 
Call dudaima 
End Sub 
 
Private Sub txt_Click() 
'打开文本说明 
Call shuom 
End Sub 
 
Private Sub unlogin_Click() 
'注销登录 
If MsgBox("确认退出考试,若退出本次考试将无效?", vbOKCancel, "实验考试系统") = vbOK Then 
Form1.show 
Unload Me 
Else 
Cancel = 1 
Exit Sub 
End If 
End Sub 
 
Private Sub Timer1_Timer() 
'显示系统当前时间 
Label1(10).Caption = addtime(Now(), 0) 
 
End Sub 
 
 
'倒计时一个小时 
Private Sub Timer2_Timer() 
Label1(13).Caption = Form4.Label1(3).Caption 
If Label1(13).Caption = "00:15:00" Then MsgBox "你还有十五分钟的时间", vbInformation, "实验考试系统" 
If Label1(13).Caption = "00:00:00" Then 
msg = "时间已到,按回车键交卷!" 
MsgBox msg, 48, "注意" 
Call Command1_Click 
End If 
End Sub 
 
 
Private Sub xinxi_Click() 
'得到学号 
xuehao = Right(Label5.Caption, 6) 
Form2.show 
'保存考试成绩 
Open "data\ksxx.dat" For Random As #1 Len = Len(kaosheng) 
For i = 1 To LOF(1) \ Len(kaosheng) 
Get #1, i, kaosheng 
If RTrim(kaosheng.xuehao) = RTrim(xuehao) Then 
Form2.Text1(1).text = kaosheng.xuehao 
Form2.Text1(0).text = kaosheng.xingming 
Form2.Text1(2).text = kaosheng.zhunkaozheng 
Form2.Text1(3).text = kaosheng.age 
Form2.Text1(4).text = kaosheng.sex 
Form2.Text1(5).text = kaosheng.score 
Exit For 
End If 
Next i 
Close #1 
Form2.Command3.Enabled = False 
Form2.unlogin.Enabled = False 
End Sub