www.pudn.com > stu_rag.rar > frmAnswer.frm, change:2003-03-16,size:8605b


VERSION 5.00 
Begin VB.Form frmAnswer  
   BackColor       =   &H00F0C284& 
   BorderStyle     =   0  'None 
   Caption         =   "Form1" 
   ClientHeight    =   5100 
   ClientLeft      =   0 
   ClientTop       =   0 
   ClientWidth     =   7548 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   5100 
   ScaleWidth      =   7548 
   ShowInTaskbar   =   0   'False 
   StartUpPosition =   2  'CenterScreen 
   Begin VB.TextBox txtAnswer  
      Appearance      =   0  'Flat 
      Height          =   1575 
      Left            =   120 
      MultiLine       =   -1  'True 
      ScrollBars      =   2  'Vertical 
      TabIndex        =   15 
      Top             =   2880 
      Width           =   7335 
   End 
   Begin VB.CommandButton CmdSubmit  
      Caption         =   "交卷" 
      Height          =   375 
      Left            =   6360 
      TabIndex        =   6 
      Top             =   4560 
      Width           =   1095 
   End 
   Begin VB.CommandButton CmdLast  
      Caption         =   "最后一题" 
      Height          =   375 
      Left            =   3720 
      TabIndex        =   5 
      Top             =   4560 
      Width           =   975 
   End 
   Begin VB.CommandButton CmdNext  
      Caption         =   "下一题" 
      Height          =   375 
      Left            =   2520 
      TabIndex        =   4 
      Top             =   4560 
      Width           =   975 
   End 
   Begin VB.CommandButton CmdPrev  
      Caption         =   "上一题" 
      Height          =   375 
      Left            =   1320 
      TabIndex        =   3 
      Top             =   4560 
      Width           =   975 
   End 
   Begin VB.CommandButton CmdFirst  
      Caption         =   "第一题" 
      Height          =   375 
      Left            =   120 
      TabIndex        =   2 
      Top             =   4560 
      Width           =   975 
   End 
   Begin VB.Frame FrameAnswer  
      Appearance      =   0  'Flat 
      BackColor       =   &H80000005& 
      ForeColor       =   &H80000008& 
      Height          =   1575 
      Left            =   120 
      TabIndex        =   1 
      Top             =   2760 
      Width           =   7335 
      Begin VB.CheckBox ChkChoice  
         Caption         =   "Check4" 
         Height          =   255 
         Index           =   4 
         Left            =   3600 
         TabIndex        =   14 
         Top             =   960 
         Width           =   3495 
      End 
      Begin VB.CheckBox ChkChoice  
         Caption         =   "Check3" 
         Height          =   255 
         Index           =   3 
         Left            =   120 
         TabIndex        =   13 
         Top             =   960 
         Width           =   3375 
      End 
      Begin VB.CheckBox ChkChoice  
         Caption         =   "Check2" 
         Height          =   255 
         Index           =   2 
         Left            =   3600 
         TabIndex        =   12 
         Top             =   240 
         Width           =   3495 
      End 
      Begin VB.CheckBox ChkChoice  
         Caption         =   "Check1" 
         Height          =   255 
         Index           =   1 
         Left            =   120 
         TabIndex        =   11 
         Top             =   240 
         Width           =   3375 
      End 
      Begin VB.OptionButton OptChoice  
         Caption         =   "Option4" 
         Height          =   255 
         Index           =   4 
         Left            =   3600 
         TabIndex        =   10 
         Top             =   960 
         Width           =   3495 
      End 
      Begin VB.OptionButton OptChoice  
         Caption         =   "Option3" 
         Height          =   255 
         Index           =   3 
         Left            =   120 
         TabIndex        =   9 
         Top             =   960 
         Width           =   3375 
      End 
      Begin VB.OptionButton OptChoice  
         Caption         =   "Option2" 
         Height          =   255 
         Index           =   2 
         Left            =   3600 
         TabIndex        =   8 
         Top             =   240 
         Width           =   3495 
      End 
      Begin VB.OptionButton OptChoice  
         Caption         =   "Option1" 
         Height          =   255 
         Index           =   1 
         Left            =   120 
         TabIndex        =   7 
         Top             =   240 
         Width           =   3375 
      End 
   End 
   Begin VB.TextBox txtQuestion  
      Appearance      =   0  'Flat 
      BeginProperty Font  
         Name            =   "仿宋_GB2312" 
         Size            =   14.4 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   2535 
      Left            =   120 
      Locked          =   -1  'True 
      MultiLine       =   -1  'True 
      ScrollBars      =   2  'Vertical 
      TabIndex        =   0 
      Top             =   120 
      Width           =   7335 
   End 
End 
Attribute VB_Name = "frmAnswer" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Dim iCount As Long 
Dim Answer As String 
Dim Ttype As QuestionType 
Dim AnswerSet As Boolean 
Private Sub PrepareQuestion(ByVal iCount As Long) 
    Dim i As Byte 
    Dim S() As String 
    Dim QSerial As Long 
    QSerial = QPaper.GetQSerial(iCount) 
    txtQuestion.Text = QPaper.GetQuestion(QSerial) 
    Ttype = QPaper.GetType(QSerial) 
    FrameAnswer.Visible = False 
    txtAnswer.Visible = False 
    For i = 1 To 4 
        OptChoice(i).Visible = False 
        ChkChoice(i).Visible = False 
    Next 
    Select Case Ttype 
        Case Blacks, EssayQuestion 
            txtAnswer.Visible = True 
        Case RightOrWrong 
            FrameAnswer.Visible = True 
            OptChoice(1).Visible = True 
            OptChoice(2).Visible = True 
            OptChoice(1).Caption = "对" 
            OptChoice(2).Caption = "错" 
        Case singlesel 
            FrameAnswer.Visible = True 
            S = Split(QPaper.GetChoice(QSerial), ",") 
            For i = 1 To 4 
                OptChoice(i).Visible = True 
                OptChoice(i).Caption = S(i - 1) 
            Next 
        Case MultiSel 
            FrameAnswer.Visible = True 
            S = Split(QPaper.GetChoice(QSerial), ",") 
            For i = 1 To 4 
                ChkChoice(i).Visible = True 
                ChkChoice(i).Caption = S(i - 1) 
            Next 
        Case Else 
    End Select 
    AnswerSet = False 
End Sub 
Private Sub SetAnswer() 
    Dim i As Byte 
    Answer = "" 
    Select Case Ttype 
        Case Blacks, EssayQuestion 
            Answer = txtAnswer 
        Case RightOrWrong 
            Answer = OptChoice(1).Value 
        Case singlesel 
            For i = 1 To 4 
                If OptChoice(i).Value Then 
                    Answer = i 
                End If 
            Next 
        Case MultiSel 
            For i = 1 To 4 
                If ChkChoice(i).Value = 1 Then 
                     Answer = Answer & "," & CStr(i) 
                End If 
            Next 
            If Len(Answer) > 0 Then 
                Answer = Right(Answer, Len(Answer) - 1) 
            End If 
            'MsgBox Answer 
    End Select 
    QPaper.SetAnswer iCount, Answer 
    AnswerSet = True 
End Sub 
Private Sub CmdFirst_Click() 
    If Not AnswerSet Then 
        SetAnswer 
    End If 
    iCount = 1 
    PrepareQuestion (iCount) 
End Sub 
 
Private Sub CmdLast_Click() 
    If Not AnswerSet Then 
        SetAnswer 
    End If 
    iCount = QPaper.QuestionNum 
    PrepareQuestion (iCount) 
End Sub 
 
Private Sub CmdNext_Click() 
    If Not AnswerSet Then 
        SetAnswer 
    End If 
    If iCount < QPaper.QuestionNum Then 
        iCount = iCount + 1 
        PrepareQuestion (iCount) 
    End If 
End Sub 
 
Private Sub CmdPrev_Click() 
    If Not AnswerSet Then 
        SetAnswer 
    End If 
    If iCount > 1 Then 
        iCount = iCount - 1 
        PrepareQuestion (iCount) 
    End If 
End Sub 
Private Sub CmdSubmit_Click() 
    If Not AnswerSet Then 
        SetAnswer 
    End If 
    Unload Me 
End Sub 
Private Sub Form_Load() 
    iCount = 1 
    PrepareQuestion (iCount) 
End Sub 
 
Private Sub Form_Unload(Cancel As Integer) 
    QPaper.Answered = True 
End Sub