www.pudn.com > textmanager.rar > FrmTianKong.frm, change:2005-04-12,size:28943b


VERSION 5.00 
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX" 
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX" 
Begin VB.Form FrmTianKong  
   Caption         =   "填空题录入" 
   ClientHeight    =   7800 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   11880 
   LinkTopic       =   "Form1" 
   LockControls    =   -1  'True 
   ScaleHeight     =   7800 
   ScaleWidth      =   11880 
   StartUpPosition =   3  '窗口缺省 
   WindowState     =   2  'Maximized 
   Begin VB.Frame Frame1  
      Caption         =   "填空题编辑" 
      Height          =   7995 
      Left            =   165 
      TabIndex        =   0 
      Top             =   120 
      Width           =   11580 
      Begin VB.Frame Frame3  
         Caption         =   "题目编辑" 
         Height          =   7560 
         Left            =   2340 
         TabIndex        =   5 
         Top             =   285 
         Width           =   9150 
         Begin VB.Frame Frame8  
            Caption         =   "编辑" 
            Height          =   1230 
            Left            =   7230 
            TabIndex        =   24 
            Top             =   5820 
            Width           =   1755 
            Begin VB.CommandButton CmdExit  
               Appearance      =   0  'Flat 
               Height          =   300 
               Left            =   930 
               Picture         =   "FrmTianKong.frx":0000 
               Style           =   1  'Graphical 
               TabIndex        =   29 
               ToolTipText     =   "关闭窗口" 
               Top             =   840 
               Width           =   645 
            End 
            Begin VB.CheckBox CheQK  
               Appearance      =   0  'Flat 
               Caption         =   "添加时清空" 
               ForeColor       =   &H80000008& 
               Height          =   195 
               Left            =   300 
               TabIndex        =   28 
               Top             =   210 
               Value           =   1  'Checked 
               Width           =   1200 
            End 
            Begin VB.CommandButton CmdDel  
               Appearance      =   0  'Flat 
               Height          =   300 
               Left            =   195 
               Picture         =   "FrmTianKong.frx":0088 
               Style           =   1  'Graphical 
               TabIndex        =   27 
               ToolTipText     =   "删除该题目" 
               Top             =   840 
               Width           =   645 
            End 
            Begin VB.CommandButton CmdEdit  
               Appearance      =   0  'Flat 
               Height          =   300 
               Left            =   930 
               Picture         =   "FrmTianKong.frx":0117 
               Style           =   1  'Graphical 
               TabIndex        =   26 
               ToolTipText     =   "编辑题目" 
               Top             =   465 
               Width           =   645 
            End 
            Begin VB.CommandButton CmdNew  
               Appearance      =   0  'Flat 
               Height          =   300 
               Left            =   195 
               Picture         =   "FrmTianKong.frx":01A1 
               Style           =   1  'Graphical 
               TabIndex        =   25 
               ToolTipText     =   "添加题目" 
               Top             =   465 
               Width           =   645 
            End 
         End 
         Begin VB.ComboBox CmbNanDu  
            BackColor       =   &H00E8F4F8& 
            Enabled         =   0   'False 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   330 
            ItemData        =   "FrmTianKong.frx":020F 
            Left            =   7170 
            List            =   "FrmTianKong.frx":021C 
            Style           =   2  'Dropdown List 
            TabIndex        =   17 
            Top             =   240 
            Width           =   750 
         End 
         Begin VB.Frame Frame5  
            Caption         =   "答案录入" 
            Height          =   3720 
            Left            =   165 
            TabIndex        =   7 
            Top             =   3765 
            Width           =   6915 
            Begin MSComCtl2.UpDown UDCount  
               Height          =   315 
               Left            =   2595 
               TabIndex        =   15 
               Top             =   210 
               Width           =   270 
               _ExtentX        =   476 
               _ExtentY        =   556 
               _Version        =   393216 
               Value           =   1 
               BuddyControl    =   "TXTCount" 
               BuddyDispid     =   196619 
               OrigLeft        =   2700 
               OrigTop         =   210 
               OrigRight       =   2970 
               OrigBottom      =   510 
               Max             =   30 
               Min             =   1 
               SyncBuddy       =   -1  'True 
               BuddyProperty   =   0 
               Enabled         =   -1  'True 
            End 
            Begin VB.TextBox TXTCount  
               Appearance      =   0  'Flat 
               BackColor       =   &H00E8F4F8& 
               BeginProperty Font  
                  Name            =   "宋体" 
                  Size            =   12 
                  Charset         =   134 
                  Weight          =   700 
                  Underline       =   0   'False 
                  Italic          =   0   'False 
                  Strikethrough   =   0   'False 
               EndProperty 
               Height          =   300 
               Left            =   2190 
               Locked          =   -1  'True 
               TabIndex        =   14 
               Text            =   "1" 
               Top             =   225 
               Width           =   390 
            End 
            Begin VB.Frame Frame6  
               Height          =   3150 
               Left            =   90 
               TabIndex        =   9 
               Top             =   480 
               Width           =   6765 
               Begin VB.VScrollBar VSDA  
                  Height          =   2940 
                  LargeChange     =   200 
                  Left            =   6555 
                  SmallChange     =   200 
                  TabIndex        =   22 
                  Top             =   150 
                  Width           =   165 
               End 
               Begin VB.PictureBox PicParent  
                  Appearance      =   0  'Flat 
                  BackColor       =   &H80000003& 
                  ForeColor       =   &H80000008& 
                  Height          =   2940 
                  Left            =   60 
                  ScaleHeight     =   2910 
                  ScaleWidth      =   6435 
                  TabIndex        =   18 
                  Top             =   150 
                  Width           =   6465 
                  Begin VB.PictureBox PicDA  
                     Appearance      =   0  'Flat 
                     BackColor       =   &H80000000& 
                     Enabled         =   0   'False 
                     ForeColor       =   &H80000008& 
                     Height          =   2910 
                     Left            =   0 
                     ScaleHeight     =   2880 
                     ScaleWidth      =   6405 
                     TabIndex        =   19 
                     Top             =   0 
                     Width           =   6435 
                     Begin VB.TextBox TxTDaan  
                        Appearance      =   0  'Flat 
                        BackColor       =   &H00E8F4F8& 
                        BeginProperty Font  
                           Name            =   "宋体" 
                           Size            =   10.5 
                           Charset         =   134 
                           Weight          =   400 
                           Underline       =   0   'False 
                           Italic          =   0   'False 
                           Strikethrough   =   0   'False 
                        EndProperty 
                        Height          =   315 
                        Index           =   0 
                        Left            =   795 
                        TabIndex        =   20 
                        Top             =   105 
                        Visible         =   0   'False 
                        Width           =   2730 
                     End 
                     Begin VB.Label LabDaan  
                        AutoSize        =   -1  'True 
                        BackStyle       =   0  'Transparent 
                        Caption         =   "1、" 
                        BeginProperty Font  
                           Name            =   "宋体" 
                           Size            =   12 
                           Charset         =   134 
                           Weight          =   400 
                           Underline       =   0   'False 
                           Italic          =   0   'False 
                           Strikethrough   =   0   'False 
                        EndProperty 
                        Height          =   240 
                        Index           =   0 
                        Left            =   450 
                        TabIndex        =   21 
                        Top             =   150 
                        Visible         =   0   'False 
                        Width           =   270 
                     End 
                  End 
               End 
            End 
            Begin VB.Label Label2  
               AutoSize        =   -1  'True 
               Caption         =   "填空个数:" 
               BeginProperty Font  
                  Name            =   "宋体" 
                  Size            =   10.5 
                  Charset         =   134 
                  Weight          =   400 
                  Underline       =   0   'False 
                  Italic          =   0   'False 
                  Strikethrough   =   0   'False 
               EndProperty 
               Height          =   210 
               Left            =   1275 
               TabIndex        =   8 
               Top             =   255 
               Width           =   1050 
            End 
         End 
         Begin VB.Frame Frame4  
            Height          =   3105 
            Left            =   180 
            TabIndex        =   6 
            Top             =   630 
            Width           =   8055 
            Begin VB.TextBox RtbTK  
               Appearance      =   0  'Flat 
               BackColor       =   &H00E8F4F8& 
               BeginProperty Font  
                  Name            =   "宋体" 
                  Size            =   12 
                  Charset         =   134 
                  Weight          =   400 
                  Underline       =   0   'False 
                  Italic          =   0   'False 
                  Strikethrough   =   0   'False 
               EndProperty 
               Height          =   2880 
               Left            =   45 
               Locked          =   -1  'True 
               MultiLine       =   -1  'True 
               ScrollBars      =   2  'Vertical 
               TabIndex        =   23 
               Top             =   150 
               Width           =   7935 
            End 
         End 
         Begin VB.Label Label7  
            AutoSize        =   -1  'True 
            Caption         =   "难度:" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   210 
            Left            =   6630 
            TabIndex        =   16 
            Top             =   300 
            Width           =   540 
         End 
         Begin VB.Label LabNianJi  
            AutoSize        =   -1  'True 
            Caption         =   "所属科目:" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   700 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            ForeColor       =   &H000000C0& 
            Height          =   240 
            Left            =   4755 
            TabIndex        =   13 
            Top             =   285 
            Width           =   1290 
         End 
         Begin VB.Label Label5  
            AutoSize        =   -1  'True 
            Caption         =   "所属年级:" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   210 
            Left            =   3795 
            TabIndex        =   12 
            Top             =   315 
            Width           =   1050 
         End 
         Begin VB.Label LabKeMu  
            AutoSize        =   -1  'True 
            Caption         =   "所属科目:" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   700 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            ForeColor       =   &H000000C0& 
            Height          =   240 
            Left            =   1410 
            TabIndex        =   11 
            Top             =   285 
            Width           =   1290 
         End 
         Begin VB.Label Label3  
            AutoSize        =   -1  'True 
            Caption         =   "所属科目:" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   210 
            Left            =   435 
            TabIndex        =   10 
            Top             =   315 
            Width           =   1050 
         End 
         Begin VB.Shape Shape1  
            Height          =   405 
            Left            =   225 
            Top             =   210 
            Width           =   7995 
         End 
      End 
      Begin VB.Frame Frame2  
         Height          =   7545 
         Left            =   420 
         TabIndex        =   1 
         Top             =   285 
         Width           =   1770 
         Begin VB.ComboBox CmbND  
            BackColor       =   &H00E8F4F8& 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   330 
            ItemData        =   "FrmTianKong.frx":022C 
            Left            =   675 
            List            =   "FrmTianKong.frx":023C 
            Style           =   2  'Dropdown List 
            TabIndex        =   3 
            Top             =   195 
            Width           =   750 
         End 
         Begin VB.ListBox LstTM  
            Appearance      =   0  'Flat 
            BackColor       =   &H00E8F4F8& 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   6750 
            ItemData        =   "FrmTianKong.frx":0252 
            Left            =   240 
            List            =   "FrmTianKong.frx":025C 
            Sorted          =   -1  'True 
            TabIndex        =   2 
            Top             =   585 
            Width           =   1380 
         End 
         Begin VB.Label Label1  
            AutoSize        =   -1  'True 
            Caption         =   "难度" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   210 
            Left            =   150 
            TabIndex        =   4 
            Top             =   240 
            Width           =   420 
         End 
      End 
   End 
   Begin MSComctlLib.ImageList ImgLst  
      Left            =   0 
      Top             =   0 
      _ExtentX        =   1005 
      _ExtentY        =   1005 
      BackColor       =   -2147483643 
      ImageWidth      =   95 
      ImageHeight     =   24 
      MaskColor       =   12632256 
      _Version        =   393216 
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}  
         NumListImages   =   4 
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmTianKong.frx":0270 
            Key             =   "save" 
         EndProperty 
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmTianKong.frx":0301 
            Key             =   "undo" 
         EndProperty 
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmTianKong.frx":0370 
            Key             =   "new" 
         EndProperty 
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmTianKong.frx":03EE 
            Key             =   "edit" 
         EndProperty 
      EndProperty 
   End 
End 
Attribute VB_Name = "FrmTianKong" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Option Explicit 
Dim NewOrEdit As String 
'▲▲,各数据段的分割符 
 
'检查试卷库里是否已经用了该题目 
Function CheckTestId(ByVal Qid As Long, ByVal IdString) As Boolean 
  CheckTestId = True 
  Dim i As Integer 
  Dim IDArr() As String 
  If IdString <> "" Then 
    IDArr = Split(IdString, ",") 
    For i = 0 To UBound(IDArr) 
      If Qid = Val(IDArr(i)) Then Exit Function 
    Next i 
  End If 
  CheckTestId = False 
End Function 
'从LstTM里取得ID号,返回为long型 
Function GetID(ByVal IdString) As Long 
   GetID = Val(Mid(IdString, 2)) 
    
End Function 
 
Private Sub CmbND_Click() 
    Dim adoRs As Recordset 
   Set adoRs = New Recordset 
   '查询题目id 
   If CmbND.ListIndex <> 0 Then 
     adoRs.Open "select id from questionTK where kemuid=" & UseKeMuID & " and nianjiid=" & UseNianJiID & " and nandu='" & CmbND.Text & "'", DB, adOpenStatic, adLockOptimistic 
    Else 
     adoRs.Open "select id from questionTK where kemuid=" & UseKeMuID & " and nianjiid=" & UseNianJiID, DB, adOpenStatic, adLockOptimistic 
   End If 
   LstTM.Clear 
  '添加列表 
  Do While Not adoRs.EOF 
    LstTM.AddItem "第" & adoRs.Fields("id").Value & "题" 
    adoRs.MoveNext 
  Loop 
  Set adoRs = Nothing 
  '设置对应的难度选择项 
  SetText CmbND.Text, CmbNanDu 
 
End Sub 
 
Private Sub CmdDel_Click() 
 
If LstTM.ListIndex < 0 Then 
 MsgBox "你还没有选择要删除的题目呢!", vbExclamation, "系统提示" 
 Exit Sub 
End If 
'========================若此题已被使用则不能删除*****《待做》 
 
Dim adoRs As Recordset 
Set adoRs = New Recordset 
adoRs.Open "select tiankong from test where kemuid=" & UseKeMuID & " and nianjiid=" & UseNianJiID, DB, adOpenStatic, adLockOptimistic 
 
Dim TiID As Long 
'获得ID号 
TiID = GetID(LstTM.List(LstTM.ListIndex)) 
 
Do While Not adoRs.EOF 
  'MsgBox adoRs.Fields("danxuan") 
 ' MsgBox CmdDel.Tag 
  If CheckTestId(TiID, adoRs.Fields("tiankong")) Then 
    MsgBox "试卷库里以使用此题目,现在不能删除!" 
    Set adoRs = Nothing 
    Exit Sub 
  End If 
  adoRs.MoveNext 
Loop 
 Set adoRs = Nothing 
  
Dim Result As String 
Result = MsgBox("你确实要删除此题目吗!此为无返回过程", vbYesNo + vbExclamation, "提问?") 
If Result = vbNo Then Exit Sub 
  
'从数据库中删除题目 
 
Dim sql1 As String 
sql1 = "delete from questionTK where id=" & TiID 
DB.Execute sql1 
'从LISTVIEW删除题目 
LstTM.RemoveItem LstTM.ListIndex 
 
'清除控件内容 
ClsTM 
 
End Sub 
'判断输入是否合格 
Function CheckIn() As Boolean 
  CheckIn = False 
  If RtbTK.Text = "" Then 
    MsgBox "请输入填空题的问题主体!" 
    RtbTK.SetFocus 
    Exit Function 
  End If 
  Dim i As Integer 
  For i = 1 To Val(TXTCount.Text) 
    If TxTDaan(i).Text = "" Then 
       MsgBox "请输入完整的题目答案,以便判卷!" 
       TxTDaan(i).SetFocus 
       Exit Function 
    End If 
  Next i 
  CheckIn = True 
End Function 
Private Sub CmdEdit_Click() 
  Dim TiID As Long 
 If CmdNew.ToolTipText = "添加题目" Then 
  If LstTM.ListIndex < 0 And NewOrEdit <> "New" Then 
   MsgBox "请选择要修改的题目!" 
   Exit Sub 
  End If 
  '========================若此题已被使用则不能修改 
 
  Dim adoRs As Recordset 
  Set adoRs = New Recordset 
  adoRs.Open "select tiankong from test where kemuid=" & UseKeMuID & " and nianjiid=" & UseNianJiID, DB, adOpenStatic, adLockOptimistic 
  '获得ID号 
  TiID = GetID(LstTM.List(LstTM.ListIndex)) 
  Do While Not adoRs.EOF 
    If CheckTestId(TiID, adoRs.Fields("tiankong")) Then 
      MsgBox "试卷库里以使用此题目,现在不能修改!" 
      Exit Sub 
    End If 
    adoRs.MoveNext 
  Loop 
  Set adoRs = Nothing 
   
  SetEnabled True 
  CmdNew.Picture = ImgLst.ListImages(1).Picture 
  CmdEdit.Picture = ImgLst.ListImages(2).Picture 
  CmdNew.ToolTipText = "保存题目" 
  CmdEdit.ToolTipText = "取消保存" 
  NewOrEdit = "Edit" 
 Else 
   If LstTM.ListIndex < 0 Then GoTo NoUndo 
  '返回到原状态 
   Dim adoTMRs As Recordset 
   Dim sql As String 
   Set adoTMRs = New Recordset 
   '获得ID号 
   TiID = GetID(LstTM.List(LstTM.ListIndex)) 
   sql = "select * from questionTK where id=" & TiID 
   adoTMRs.Open sql, DB, adOpenStatic, adLockOptimistic 
   '清除控件 
   ClsTM 
   PlayTM adoTMRs 
   adoTMRs.Close 
NoUndo: 
  SetEnabled False 
  CmdNew.Picture = ImgLst.ListImages(3).Picture 
  CmdEdit.Picture = ImgLst.ListImages(4).Picture 
  CmdNew.ToolTipText = "添加题目" 
  CmdEdit.ToolTipText = "编辑题目" 
  NewOrEdit = "" 
 End If 
  
End Sub 
'清空题目 
Sub ClsTM() 
 RtbTK.Text = "" 
 Dim i As Integer 
 For i = 1 To 30 
   TxTDaan(i).Text = "" 
 Next i 
 TXTCount.Text = 1 
End Sub 
 
Private Sub CmdExit_Click() 
  Unload Me 
End Sub 
 
Private Sub CmdNew_Click() 
  If CmdNew.ToolTipText = "添加题目" Then 
  SetEnabled True 
  CmdNew.Picture = ImgLst.ListImages(1).Picture 
  CmdEdit.Picture = ImgLst.ListImages(2).Picture 
  CmdNew.ToolTipText = "保存题目" 
  CmdEdit.ToolTipText = "取消保存" 
  NewOrEdit = "New" 
  If CheQK.Value = 1 Then 
    '清空 
    ClsTM 
  End If 
 Else 
   
    '判断输入是否合格 
    If CheckIn = False Then 
       Exit Sub 
    End If 
    Dim sql As String 
    Dim NanDuStr As String, DaanStr As String 
    NanDuStr = CmbNanDu.Text 
    '得到答案字符串 
    Dim i As Integer 
    DaanStr = "" 
    For i = 1 To Val(TXTCount.Text) 
       DaanStr = DaanStr + TxTDaan(i).Text + "▲▲" 
    Next i 
    DaanStr = Left(DaanStr, Len(DaanStr) - 2) 
    '判断是添加还是编辑 
    If NewOrEdit = "New" Then 
      Dim Qid As Long '题目Id 
      Qid = GetAutoID("questionTK") 
      sql = "insert into questionTK(id,kemuid,nianjiid,wenti,Kcount,daan,nandu) values (" 
      sql = sql & Qid & "," & UseKeMuID & "," & UseNianJiID & ",'" & RtbTK.Text & "'," & TXTCount.Text & ",'" & DaanStr & "','" & NanDuStr & "')" 
      DB.Execute sql 
      LstTM.AddItem "第" & Qid & "题" 
     Else 
      '更新 
      '用CmdNew控件的Tag属性保存题目ID 
      sql = "update questionTK set wenti='" & RtbTK.Text & "',Kcount=" & TXTCount.Text & ",daan='" & DaanStr & "',nandu='" & NanDuStr & "' where id=" & GetID(LstTM.List(LstTM.ListIndex)) 
      DB.Execute sql 
    End If 
   
  SetEnabled False 
  CmdNew.Picture = ImgLst.ListImages(3).Picture 
  CmdEdit.Picture = ImgLst.ListImages(4).Picture 
  CmdNew.ToolTipText = "添加题目" 
  CmdEdit.ToolTipText = "编辑题目" 
  NewOrEdit = "" 
 End If 
 
'adoQuestionRs.Close 
 
End Sub 
 
Private Sub Form_Load() 
  CmbND.ListIndex = 0 
  CmbNanDu.ListIndex = 0 
  Dim adoRs As Recordset 
  Set adoRs = New Recordset 
  adoRs.Open "select id from questionTK where kemuid=" & UseKeMuID & " and nianjiid=" & UseNianJiID, DB, adOpenStatic, adLockOptimistic 
  LstTM.Clear 
  Do While Not adoRs.EOF 
    LstTM.AddItem "第" & adoRs.Fields("id").Value & "题" 
    adoRs.MoveNext 
  Loop 
  Set adoRs = Nothing 
  '创建控件 
  CreateDA 
  LabDaan(1).Visible = True 
  TxTDaan(1).Visible = True 
End Sub 
'设置是否可以编辑 
Sub SetEnabled(ByVal TF As Boolean) 
  CmbNanDu.Enabled = TF 
  RtbTK.Locked = Not TF 
  UDCount.Enabled = TF 
  PicDA.Enabled = TF 
  CmdDel.Enabled = Not TF 
  Frame2.Enabled = Not TF 
End Sub 
'产生填空框 
Sub CreateDA() 
  Dim i As Integer 
  For i = 1 To 30 
    If (i Mod 2) = 0 Then 
       Load LabDaan(i) 
       LabDaan(i).Caption = i & "、" 
       LabDaan(i).Left = 3190 
       'LabDaan(i).Visible = True 
       Load TxTDaan(i) 
       TxTDaan(i).Left = 3525 
       'TxTDaan(i).Visible = True 
    Else 
       Load LabDaan(i) 
       LabDaan(i).Caption = i & "、" 
       LabDaan(i).Left = 100 
       'LabDaan(i).Visible = True 
       Load TxTDaan(i) 
       TxTDaan(i).Left = 435 
       'TxTDaan(i).Visible = True 
     
     End If 
     TxTDaan(i).Top = (Round((i / 2) + 0.1) - 1) * 315 + Round((i / 2) + 0.2) * 100 
     LabDaan(i).Top = TxTDaan(i).Top 
  Next i 
  PicDA.Height = TxTDaan(30).Top + 315 + 100 
  VSDA.Max = PicDA.Height - PicParent.Height 
  VSDA.Min = 0 
End Sub 
 
Private Sub LstTM_Click() 
 Dim adoRs As Recordset 
 Set adoRs = New Recordset 
 adoRs.Open "select * from questionTK where id=" & GetID(LstTM.List(LstTM.ListIndex)), DB, adOpenStatic, adLockOptimistic 
 PlayTM adoRs 
 Set adoRs = Nothing 
End Sub 
 
Private Sub RtbTK_KeyPress(KeyAscii As Integer) 
   If KeyAscii = 39 Then KeyAscii = -24145 
 
End Sub 
 
Private Sub TXTCount_Change() 
  Dim i As Integer 
  For i = 1 To 30 
    LabDaan(i).Visible = False 
    TxTDaan(i).Visible = False 
  Next i 
  For i = 1 To Val(TXTCount.Text) 
    LabDaan(i).Visible = True 
    TxTDaan(i).Visible = True 
  Next i 
   
End Sub 
 
Private Sub TxTDaan_KeyPress(Index As Integer, KeyAscii As Integer) 
    If KeyAscii = 39 Then KeyAscii = -24145 
 
End Sub 
 
Private Sub VSDA_Change() 
  PicDA.Top = -1 * VSDA.Value 
End Sub 
'显示题目 
Sub PlayTM(ByVal adoRs As Recordset) 
  Dim strArr() As String 
  Dim i As Integer 
  SetText adoRs.Fields("nandu").Value, CmbNanDu 
  RtbTK.Text = adoRs.Fields("wenti").Value 
  TXTCount.Text = adoRs.Fields("kcount").Value 
  strArr = Split(adoRs.Fields("daan").Value, "▲▲") 
  For i = 1 To Val(TXTCount.Text) 
    TxTDaan(i).Text = strArr(i - 1) 
  Next i 
End Sub 
'显示下来列表的列 
Sub SetText(ByVal TXT As String, ByVal CmbBox As ComboBox) 
  Dim i As Integer 
  For i = 0 To CmbBox.ListCount - 1 
    If CmbBox.List(i) = TXT Then 
      CmbBox.ListIndex = i 
      Exit Sub 
    End If 
  Next i 
End Sub