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

📄 frmks.frm

📁 内容为:驾驶考试管理系统 内含说明书 可直接使用实例 VB+SQL
💻 FRM
📖 第 1 页 / 共 3 页
字号:
            Index           =   0
            Left            =   1485
            Locked          =   -1  'True
            MultiLine       =   -1  'True
            TabIndex        =   16
            TabStop         =   0   'False
            Text            =   "frmKS.frx":06A0
            Top             =   180
            Width           =   7035
         End
         Begin VB.Label lblAnswer 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Label2"
            DataField       =   "ksda"
            DataSource      =   "Adodc1"
            ForeColor       =   &H000000FF&
            Height          =   180
            Left            =   4455
            TabIndex        =   26
            Top             =   5160
            Width           =   540
         End
         Begin VB.Label label10 
            AutoSize        =   -1  'True
            BackColor       =   &H8000000E&
            BackStyle       =   0  'Transparent
            Caption         =   "选择答案(按下相应的字母如A、B等即可):"
            ForeColor       =   &H00FF0000&
            Height          =   180
            Left            =   1050
            TabIndex        =   25
            Top             =   5160
            Width           =   3420
         End
         Begin VB.Label Label1 
            Alignment       =   1  'Right Justify
            BackColor       =   &H8000000E&
            BackStyle       =   0  'Transparent
            Caption         =   "F、"
            ForeColor       =   &H000000FF&
            Height          =   180
            Index           =   6
            Left            =   825
            TabIndex        =   15
            Top             =   4245
            Width           =   540
         End
         Begin VB.Label Label1 
            Alignment       =   1  'Right Justify
            BackColor       =   &H80000009&
            BackStyle       =   0  'Transparent
            Caption         =   "E、"
            ForeColor       =   &H000000FF&
            Height          =   180
            Index           =   5
            Left            =   825
            TabIndex        =   14
            Top             =   3600
            Width           =   540
         End
         Begin VB.Label Label1 
            Alignment       =   1  'Right Justify
            BackColor       =   &H80000009&
            BackStyle       =   0  'Transparent
            Caption         =   "D、"
            ForeColor       =   &H000000FF&
            Height          =   180
            Index           =   4
            Left            =   825
            TabIndex        =   13
            Top             =   2955
            Width           =   540
         End
         Begin VB.Label Label1 
            Alignment       =   1  'Right Justify
            BackColor       =   &H80000009&
            BackStyle       =   0  'Transparent
            Caption         =   "C、"
            ForeColor       =   &H000000FF&
            Height          =   180
            Index           =   3
            Left            =   825
            TabIndex        =   12
            Top             =   2310
            Width           =   540
         End
         Begin VB.Label Label1 
            Alignment       =   1  'Right Justify
            BackColor       =   &H80000009&
            BackStyle       =   0  'Transparent
            Caption         =   "B、"
            ForeColor       =   &H000000FF&
            Height          =   180
            Index           =   2
            Left            =   825
            TabIndex        =   11
            Top             =   1665
            Width           =   540
         End
         Begin VB.Label Label1 
            Alignment       =   1  'Right Justify
            BackColor       =   &H80000009&
            BackStyle       =   0  'Transparent
            Caption         =   "A、"
            ForeColor       =   &H000000FF&
            Height          =   180
            Index           =   1
            Left            =   825
            TabIndex        =   10
            Top             =   1020
            Width           =   540
         End
         Begin VB.Label Label1 
            Alignment       =   1  'Right Justify
            BackColor       =   &H80000005&
            BackStyle       =   0  'Transparent
            Caption         =   "Label1"
            DataField       =   "stid"
            DataSource      =   "Adodc1"
            ForeColor       =   &H00FF0000&
            Height          =   180
            Index           =   0
            Left            =   660
            TabIndex        =   9
            Top             =   180
            Width           =   540
         End
      End
      Begin VB.PictureBox Picture2 
         BackColor       =   &H80000005&
         Height          =   6465
         Left            =   -74760
         ScaleHeight     =   6405
         ScaleWidth      =   8835
         TabIndex        =   27
         Top             =   540
         Width           =   8895
         Begin VB.TextBox Text2 
            BorderStyle     =   0  'None
            DataField       =   "tmmc"
            DataSource      =   "Adodc2"
            ForeColor       =   &H00FF0000&
            Height          =   930
            Left            =   1485
            Locked          =   -1  'True
            MultiLine       =   -1  'True
            TabIndex        =   33
            Text            =   "frmKS.frx":072C
            Top             =   360
            Width           =   7035
         End
         Begin VB.PictureBox Picture5 
            AutoRedraw      =   -1  'True
            BackColor       =   &H80000005&
            BorderStyle     =   0  'None
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   12
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00FFFFFF&
            Height          =   1740
            Left            =   1485
            ScaleHeight     =   1740
            ScaleWidth      =   1995
            TabIndex        =   29
            Top             =   1590
            Width           =   1995
         End
         Begin VB.PictureBox Picture6 
            AutoSize        =   -1  'True
            Height          =   975
            Left            =   5190
            ScaleHeight     =   915
            ScaleWidth      =   1230
            TabIndex        =   28
            Top             =   2505
            Visible         =   0   'False
            Width           =   1290
         End
         Begin VB.Label Label2 
            Alignment       =   1  'Right Justify
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Label2"
            DataField       =   "stid"
            DataSource      =   "Adodc2"
            ForeColor       =   &H00FF0000&
            Height          =   180
            Left            =   660
            TabIndex        =   32
            Top             =   360
            Width           =   540
         End
         Begin VB.Label Label3 
            AutoSize        =   -1  'True
            BackColor       =   &H80000005&
            BackStyle       =   0  'Transparent
            Caption         =   "选择答案(按下Y或y表示对,按下N或n表示错):"
            ForeColor       =   &H00FF0000&
            Height          =   180
            Left            =   1050
            TabIndex        =   31
            Top             =   4320
            Width           =   3780
         End
         Begin VB.Label lblYesNo 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Label2"
            DataField       =   "ksda"
            DataSource      =   "Adodc2"
            ForeColor       =   &H000000FF&
            Height          =   180
            Left            =   4860
            TabIndex        =   30
            Top             =   4320
            Width           =   540
         End
      End
   End
End
Attribute VB_Name = "frmKS"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private mrsXZT As ADODB.Recordset '选择题
Private mrsPDT As ADODB.Recordset '判断题
Private mKssj As Long '考试时间
Private mBeginTime As Date '开始时间
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As Long, ByVal lpDirectory As Long, ByVal nShowCmd As Long) As Long
Private Declare Function WinExec Lib "kernel32" (ByVal lpCmdLine As String, ByVal nCmdShow As Long) As Long
Private Const SW_SHOWNORMAL = 1
Private mbIsSubmitted As Boolean '是否已经交卷

Private msPerformance As String '成绩
Private msErrorAnswer As String '错误答案
Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
    On Error GoTo ErrHandler
    
    
    '显隐D、E、F三个选项
    If Trim("" & mrsXZT("D")) = "" Then
        Label1(4).Visible = False
    Else
        Label1(4).Visible = True
    End If
    If Trim("" & mrsXZT("E")) = "" Then
        Label1(5).Visible = False
    Else
        Label1(5).Visible = True
    End If
    If Trim("" & mrsXZT("F")) = "" Then
        Label1(6).Visible = False
    Else
        Label1(6).Visible = True
    End If
    
    '显示图片
    If Trim("" & mrsXZT("tp")) <> "" Then
        Picture4.Picture = LoadPicture(GetAppPath() & "" & mrsXZT("tp"))
        Picture4.AutoSize = True
        PaintImage PictureScaleRatio(Picture4, Picture3) * Picture3.ScaleWidth, PictureScaleRatio(Picture4, Picture3) * Picture3.ScaleHeight, Picture4, Picture3, GL_DISPLAY_CENTER
    Else
        Picture4.Picture = LoadPicture()
        Picture3.Picture = LoadPicture()
    End If
    Exit Sub
ErrHandler:
    ErrMessageBox "Adodc1_MoveComplete()", Me.Caption
End Sub

Private Sub Adodc2_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
      
    On Error GoTo ErrHandler
    '显示图片
    If Trim("" & mrsPDT("tp")) <> "" Then
        Picture6.Picture = LoadPicture(GetAppPath() & "" & mrsPDT("tp"))
        Picture6.AutoSize = True
        PaintImage PictureScaleRatio(Picture6, Picture5) * Picture5.ScaleWidth, PictureScaleRatio(Picture6, Picture5) * Picture5.ScaleHeight, Picture6, Picture5, GL_DISPLAY_CENTER
    Else
        Picture5.Picture = LoadPicture()
        Picture5.Picture = LoadPicture()
    End If
    Exit Sub
ErrHandler:
    ErrMessageBox "Adodc2_MoveComplete()", Me.Caption
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    DealWithKeyBoard KeyCode
End Sub
Private Sub Form_Load()
    Dim theArea As RECT
    Dim szSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo ErrHandler
    
    Screen.MousePointer = 11
    'get the workarea
    theArea = GetWorkArea()
    
    mbIsSubmitted = False
    '设置应用程序的主窗口的大小
    Me.Left = theArea.Left * Screen.TwipsPerPixelX
    Me.Top = theArea.Top * Screen.TwipsPerPixelX
    Me.Width = (theArea.Right - theArea.Left) * Screen.TwipsPerPixelX
    Me.Height = (theArea.Bottom - theArea.Top) * Screen.TwipsPerPixelY
    '---------------------------------------------------------------
    Call SeperateStatusBar(Me.Width)
    '------------------------------------------------------
    Me.Caption = GS_SYSTEMTITLE & "——考试中..."
    
    '随机生成试卷
    Call GenTestPaper
    '生成某个考生的试卷
    gadoCONN.Execute "DELETE FROM tbKsdj WHERE zh='" & gUserInfo.Zh & "'"
    szSQL = "INSERT INTO tbKsdj(zh,stid,tmlb_id,tmlx_id,tmbh,tmmc,tmda,tp,A,B,C,D,E,F) " & _
          "SELECT '" & gUserInfo.Zh & "',tbSj.sjbh,tbSj.tmlb_id,tbSj.tmlx_id,tbSj.tmbh," & _
          "tbTk.tmmc,tbTk.tmda,tbTk.tp,tbTk.A,tbTk.B,tbTk.C,tbTk.D,tbTk.E,tbTk.F " & _
          "FROM tbSj,tbTk " & _
          "WHERE tbSj.tmlb_id=tbTk.tmlb_id AND " & _
          "      tbSj.tmlx_id=tbTk.tmlx_id AND " & _
          "      tbSj.tmbh=tbTk.tmbh"
    
    gadoCONN.Execute szSQL
    
    '选择题
    Set mrsXZT = New ADODB.Recordset
    szSQL = "SELECT * FROM tbKsdj WHERE tmlx_id=0 AND zh='" & gUserInfo.Zh & "' ORDER BY stid ASC"
    mrsXZT.Open szSQL, gadoCONN, adOpenKeyset, adLockPessimistic, adCmdText
    If Not mrsXZT.EOF Then mrsXZT.MoveLast
    If Not mrsXZT.BOF Then mrsXZT.MoveFirst
    '判断题
    Set mrsPDT = New ADODB.Recordset
    szSQL = "SELECT * FROM tbKsdj WHERE tmlx_id=1 AND zh='" & gUserInfo.Zh & "' ORDER BY stid ASC"
    mrsPDT.Open szSQL, gadoCONN, adOpenKeyset, adLockPessimistic, adCmdText
    If Not mrsPDT.EOF Then mrsPDT.MoveLast
    If Not mrsPDT.BOF Then mrsPDT.MoveFirst
    
    '显示题目
    Set Adodc1.Recordset = mrsXZT
    Set Adodc2.Recordset = mrsPDT
    
    
    SSTab1.TabCaption(0) = "选择题(共" & CStr(Adodc1.Recordset.RecordCount) & "题)"
    SSTab1.TabCaption(1) = "判断题(共" & CStr(Adodc2.Recordset.RecordCount) & "题)"
    
    '查看各种题目的数量
    Me.Show
    If Adodc1.Recordset.RecordCount > 0 Then
        Adodc1.Recordset.Move 0
    Else
        SSTab1.Tab = 1
        SSTab1.TabEnabled(0) = False
    End If
    
    If Adodc2.Recordset.RecordCount > 0 Then
        Adodc2.Recordset.Move 0
    Else
        SSTab1.Tab = 0
        SSTab1.TabEnabled(1) = False
    End If
    '获取系统设置的考试时间
    Set rs = gadoCONN.Execute("SELECT kssj FROM tbParam WHERE id=1")
    If Not rs.EOF Then rs.MoveLast
    If Not rs.BOF Then rs.MoveFirst
    If rs.RecordCount > 0 Then
        mKssj = ToLong(rs("kssj"))
    Else
        mKssj = 45 '缺省时间为45分钟
    End If
    
    If Not rs Is Nothing Then
        If rs.State = adStateOpen Then
            rs.Close

⌨️ 快捷键说明

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