www.pudn.com > textmanager.rar > FRMQUESTIONBACK.FRM, change:2005-04-12,size:29723b


VERSION 5.00 
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx" 
Begin VB.Form frmquestion  
   Caption         =   "题目录入" 
   ClientHeight    =   8595 
   ClientLeft      =   -495 
   ClientTop       =   570 
   ClientWidth     =   11880 
   KeyPreview      =   -1  'True 
   LinkTopic       =   "Form2" 
   LockControls    =   -1  'True 
   MDIChild        =   -1  'True 
   ScaleHeight     =   8595 
   ScaleWidth      =   11880 
   Begin VB.Frame Frame3  
      Caption         =   "题目类别选择" 
      Height          =   7365 
      Left            =   60 
      TabIndex        =   17 
      Top             =   60 
      Width           =   3435 
      Begin MSComctlLib.ImageList ImgKemu  
         Left            =   2340 
         Top             =   5190 
         _ExtentX        =   1005 
         _ExtentY        =   1005 
         BackColor       =   -2147483643 
         ImageWidth      =   16 
         ImageHeight     =   16 
         MaskColor       =   12632256 
         _Version        =   393216 
         BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}  
            NumListImages   =   5 
            BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}  
               Picture         =   "frmquestionback.frx":0000 
               Key             =   "question" 
            EndProperty 
            BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}  
               Picture         =   "frmquestionback.frx":0452 
               Key             =   "kemu" 
            EndProperty 
            BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}  
               Picture         =   "frmquestionback.frx":08A4 
               Key             =   "nianji" 
            EndProperty 
            BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}  
               Picture         =   "frmquestionback.frx":0CF6 
               Key             =   "nandu" 
            EndProperty 
            BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}  
               Picture         =   "frmquestionback.frx":1148 
               Key             =   "nanduopen" 
            EndProperty 
         EndProperty 
      End 
      Begin MSComctlLib.TreeView TrVKemu  
         Height          =   6750 
         Left            =   90 
         TabIndex        =   18 
         Top             =   345 
         Width           =   3270 
         _ExtentX        =   5768 
         _ExtentY        =   11906 
         _Version        =   393217 
         Indentation     =   460 
         LabelEdit       =   1 
         LineStyle       =   1 
         Style           =   7 
         ImageList       =   "ImgKemu" 
         BorderStyle     =   1 
         Appearance      =   0 
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}  
            Name            =   "宋体" 
            Size            =   12 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
      End 
      Begin VB.ListBox List1  
         Appearance      =   0  'Flat 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   12 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         Height          =   6750 
         Left            =   2355 
         TabIndex        =   33 
         Top             =   345 
         Width           =   1020 
      End 
   End 
   Begin MSComctlLib.ImageList ImgLst  
      Left            =   4260 
      Top             =   7515 
      _ExtentX        =   1005 
      _ExtentY        =   1005 
      BackColor       =   -2147483643 
      ImageWidth      =   95 
      ImageHeight     =   24 
      MaskColor       =   12632256 
      _Version        =   393216 
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}  
         NumListImages   =   8 
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmquestionback.frx":159A 
            Key             =   "checkh" 
         EndProperty 
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmquestionback.frx":18AA 
            Key             =   "dell" 
         EndProperty 
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmquestionback.frx":1BDA 
            Key             =   "delh" 
         EndProperty 
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmquestionback.frx":1EFA 
            Key             =   "checkl" 
         EndProperty 
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmquestionback.frx":2212 
            Key             =   "save" 
         EndProperty 
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmquestionback.frx":22A3 
            Key             =   "undo" 
         EndProperty 
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmquestionback.frx":2312 
            Key             =   "new" 
         EndProperty 
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmquestionback.frx":2390 
            Key             =   "edit" 
         EndProperty 
      EndProperty 
   End 
   Begin VB.Frame Frame1  
      Caption         =   "问题录入" 
      Height          =   7365 
      Left            =   3555 
      TabIndex        =   0 
      Top             =   60 
      Width           =   8280 
      Begin VB.ComboBox CmbNanDu  
         Enabled         =   0   'False 
         Height          =   300 
         ItemData        =   "frmquestionback.frx":242A 
         Left            =   3555 
         List            =   "frmquestionback.frx":2437 
         Style           =   2  'Dropdown List 
         TabIndex        =   21 
         Top             =   540 
         Width           =   915 
      End 
      Begin VB.Frame FrmeDA  
         Caption         =   "答案" 
         Enabled         =   0   'False 
         Height          =   3840 
         Left            =   5370 
         TabIndex        =   14 
         Top             =   3435 
         Width           =   765 
         Begin VB.CheckBox CheDaAn  
            Appearance      =   0  'Flat 
            Caption         =   "A" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            ForeColor       =   &H80000008& 
            Height          =   270 
            Index           =   0 
            Left            =   150 
            TabIndex        =   15 
            Top             =   300 
            Width           =   525 
         End 
      End 
      Begin VB.ComboBox CmbKeMu  
         Appearance      =   0  'Flat 
         Enabled         =   0   'False 
         Height          =   300 
         Left            =   150 
         Style           =   2  'Dropdown List 
         TabIndex        =   5 
         Top             =   540 
         Width           =   1635 
      End 
      Begin VB.TextBox TxTTM  
         Appearance      =   0  'Flat 
         DataField       =   "wenti" 
         Height          =   2205 
         Left            =   120 
         Locked          =   -1  'True 
         MultiLine       =   -1  'True 
         ScrollBars      =   2  'Vertical 
         TabIndex        =   4 
         Top             =   1185 
         Width           =   4620 
      End 
      Begin VB.Frame Frame2  
         Caption         =   "题图" 
         Height          =   3090 
         Left            =   4845 
         TabIndex        =   3 
         Top             =   315 
         Width           =   3345 
         Begin VB.Image ImgDel  
            Height          =   360 
            Left            =   1710 
            Picture         =   "frmquestionback.frx":2447 
            Top             =   2640 
            Width           =   1425 
         End 
         Begin VB.Image ImgCheck  
            Height          =   360 
            Left            =   150 
            Picture         =   "frmquestionback.frx":2754 
            Top             =   2640 
            Width           =   1425 
         End 
         Begin VB.Image ImgTT  
            Appearance      =   0  'Flat 
            BorderStyle     =   1  'Fixed Single 
            Height          =   2295 
            Left            =   60 
            Stretch         =   -1  'True 
            Top             =   240 
            Width           =   3225 
         End 
      End 
      Begin VB.ComboBox CmbNianJi  
         Enabled         =   0   'False 
         Height          =   300 
         ItemData        =   "frmquestionback.frx":2A54 
         Left            =   1980 
         List            =   "frmquestionback.frx":2A67 
         Style           =   2  'Dropdown List 
         TabIndex        =   2 
         Top             =   540 
         Width           =   1395 
      End 
      Begin VB.Frame Frame4  
         Caption         =   "选择项" 
         Height          =   3840 
         Left            =   105 
         TabIndex        =   1 
         Top             =   3435 
         Width           =   5145 
         Begin VB.ComboBox CmbGS  
            Height          =   300 
            ItemData        =   "frmquestionback.frx":2A93 
            Left            =   2025 
            List            =   "frmquestionback.frx":2AB5 
            Style           =   2  'Dropdown List 
            TabIndex        =   31 
            Top             =   180 
            Width           =   990 
         End 
         Begin VB.VScrollBar VSXuanZe  
            Height          =   3555 
            LargeChange     =   500 
            Left            =   4920 
            SmallChange     =   500 
            TabIndex        =   12 
            Top             =   240 
            Width           =   165 
         End 
         Begin VB.PictureBox PicParent  
            Height          =   3225 
            Left            =   75 
            ScaleHeight     =   3165 
            ScaleWidth      =   4755 
            TabIndex        =   9 
            Top             =   525 
            Width           =   4815 
            Begin VB.PictureBox PicXuanZe  
               Appearance      =   0  'Flat 
               BackColor       =   &H00E0E0E0& 
               ForeColor       =   &H80000008& 
               Height          =   3135 
               Left            =   45 
               ScaleHeight     =   3105 
               ScaleWidth      =   4650 
               TabIndex        =   10 
               Top             =   15 
               Width           =   4680 
               Begin VB.TextBox TxTXuanZe  
                  Appearance      =   0  'Flat 
                  Height          =   555 
                  Index           =   0 
                  Left            =   420 
                  Locked          =   -1  'True 
                  MultiLine       =   -1  'True 
                  ScrollBars      =   2  'Vertical 
                  TabIndex        =   11 
                  Top             =   100 
                  Width           =   4200 
               End 
               Begin VB.Label LabBiaohao  
                  BackStyle       =   0  'Transparent 
                  Caption         =   "A:" 
                  BeginProperty Font  
                     Name            =   "宋体" 
                     Size            =   18 
                     Charset         =   134 
                     Weight          =   700 
                     Underline       =   0   'False 
                     Italic          =   0   'False 
                     Strikethrough   =   0   'False 
                  EndProperty 
                  ForeColor       =   &H00FF0000& 
                  Height          =   480 
                  Index           =   0 
                  Left            =   60 
                  TabIndex        =   13 
                  Top             =   165 
                  Width           =   345 
               End 
            End 
         End 
         Begin VB.Label Label1  
            Caption         =   "答案个数:" 
            Height          =   225 
            Left            =   1095 
            TabIndex        =   32 
            Top             =   225 
            Width           =   915 
         End 
      End 
      Begin VB.Frame Frame6  
         Caption         =   "操作区" 
         Height          =   3825 
         Left            =   6255 
         TabIndex        =   16 
         Top             =   3450 
         Width           =   1860 
         Begin VB.Frame Frame8  
            Caption         =   "编辑" 
            Height          =   1215 
            Left            =   105 
            TabIndex        =   26 
            Top             =   1395 
            Width           =   1665 
            Begin VB.CheckBox Check1  
               Appearance      =   0  'Flat 
               Caption         =   "添加时清空" 
               ForeColor       =   &H80000008& 
               Height          =   195 
               Left            =   300 
               TabIndex        =   30 
               Top             =   210 
               Value           =   1  'Checked 
               Width           =   1200 
            End 
            Begin VB.CommandButton CmdDel  
               Appearance      =   0  'Flat 
               Height          =   300 
               Left            =   465 
               Picture         =   "frmquestionback.frx":2AD8 
               Style           =   1  'Graphical 
               TabIndex        =   29 
               ToolTipText     =   "删除该题目" 
               Top             =   810 
               Width           =   900 
            End 
            Begin VB.CommandButton CmdEdit  
               Appearance      =   0  'Flat 
               Height          =   300 
               Left            =   930 
               Picture         =   "frmquestionback.frx":2B67 
               Style           =   1  'Graphical 
               TabIndex        =   28 
               ToolTipText     =   "编辑题目" 
               Top             =   465 
               Width           =   645 
            End 
            Begin VB.CommandButton CmdNew  
               Appearance      =   0  'Flat 
               Height          =   300 
               Left            =   195 
               Picture         =   "frmquestionback.frx":2BF1 
               Style           =   1  'Graphical 
               TabIndex        =   27 
               ToolTipText     =   "添加题目" 
               Top             =   465 
               Width           =   645 
            End 
         End 
         Begin VB.Frame FrmeMove  
            Caption         =   "移动记录" 
            Height          =   1065 
            Left            =   90 
            TabIndex        =   19 
            Top             =   285 
            Width           =   1695 
            Begin VB.CommandButton Command4  
               Appearance      =   0  'Flat 
               Height          =   300 
               Left            =   945 
               Picture         =   "frmquestionback.frx":2C5F 
               Style           =   1  'Graphical 
               TabIndex        =   25 
               ToolTipText     =   "该范围的最后一个题目" 
               Top             =   630 
               Width           =   630 
            End 
            Begin VB.CommandButton Command3  
               Appearance      =   0  'Flat 
               Height          =   300 
               Left            =   195 
               Picture         =   "frmquestionback.frx":2CC5 
               Style           =   1  'Graphical 
               TabIndex        =   24 
               ToolTipText     =   "该范围的下一个题目" 
               Top             =   630 
               Width           =   630 
            End 
            Begin VB.CommandButton Command2  
               Appearance      =   0  'Flat 
               Height          =   300 
               Left            =   930 
               Picture         =   "frmquestionback.frx":2D1D 
               Style           =   1  'Graphical 
               TabIndex        =   23 
               ToolTipText     =   "该范围的上一个题目" 
               Top             =   225 
               Width           =   645 
            End 
            Begin VB.CommandButton Command1  
               Appearance      =   0  'Flat 
               Height          =   300 
               Left            =   180 
               Picture         =   "frmquestionback.frx":2D75 
               Style           =   1  'Graphical 
               TabIndex        =   22 
               ToolTipText     =   "该范围的第一个题目" 
               Top             =   225 
               Width           =   645 
            End 
         End 
      End 
      Begin VB.Label lblLabels  
         Caption         =   "难度:" 
         Height          =   255 
         Index           =   3 
         Left            =   3555 
         TabIndex        =   20 
         Top             =   285 
         Width           =   915 
      End 
      Begin VB.Label lblLabels  
         Caption         =   "所属科目:" 
         Height          =   255 
         Index           =   1 
         Left            =   150 
         TabIndex        =   8 
         Top             =   255 
         Width           =   975 
      End 
      Begin VB.Label lblLabels  
         Caption         =   "问题主题:" 
         Height          =   255 
         Index           =   2 
         Left            =   240 
         TabIndex        =   7 
         Top             =   945 
         Width           =   975 
      End 
      Begin VB.Label lblLabels  
         Caption         =   "适应年级:" 
         Height          =   255 
         Index           =   0 
         Left            =   1980 
         TabIndex        =   6 
         Top             =   270 
         Width           =   915 
      End 
   End 
End 
Attribute VB_Name = "frmquestion" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
'标志是添加还是编辑 
Dim NewOrEdit As String 
 
'产生选择项 
Sub CreateXuanZe() 
  Dim i As Integer 
  '自动产生数组控件 
  For i = 1 To 9 
     '产生标签 
     Load LabBiaohao(i) 
     LabBiaohao(i).Caption = Chr(65 + i) + ":" 
     LabBiaohao(i).Top = 165 + 740 * i 
     LabBiaohao(i).Visible = True 
     '产生文本框 
     Load TxTXuanZe(i) 
     TxTXuanZe(i).Top = 100 + 740 * i 
     TxTXuanZe(i).Visible = True 
     '产生答案选择框 
     Load CheDaAn(i) 
     CheDaAn(i).Caption = Chr(65 + i) 
     CheDaAn(i).Top = 300 + 350 * i 
     CheDaAn(i).Visible = True 
  Next i 
  PicXuanZe.Height = 100 + 740 * 10 
  VSXuanZe.Max = PicXuanZe.Height - PicParent.Height 
  VSXuanZe.Min = 0 
  '设置处值 
  CmbGS.ListIndex = 3 
  For i = 4 To 9 
    LabBiaohao(i).Visible = False 
    TxTXuanZe(i).Visible = False 
    CheDaAn(i).Visible = False 
  Next i 
End Sub 
 
Private Sub Command5_Click() 
 
End Sub 
 
Private Sub CmbGS_Click() 
  Dim Count As Integer, i As Integer 
  Count = Val(CmbGS.Text) 
  For i = 0 To 9 
    LabBiaohao(i).Visible = True 
    TxTXuanZe(i).Visible = True 
    CheDaAn(i).Visible = True 
  Next i 
  For i = Count To 9 
    LabBiaohao(i).Visible = False 
    TxTXuanZe(i).Visible = False 
    CheDaAn(i).Visible = False 
  Next i 
End Sub 
 
Private Sub CmdEdit_Click() 
 If CmdNew.ToolTipText = "添加题目" Then 
  SetEnabled True 
  CmdNew.Picture = ImgLst.ListImages(5).Picture 
  CmdEdit.Picture = ImgLst.ListImages(6).Picture 
  CmdNew.ToolTipText = "保存题目" 
  CmdEdit.ToolTipText = "取消保存" 
  NewOrEdit = "Edit" 
 Else 
  SetEnabled False 
  CmdNew.Picture = ImgLst.ListImages(7).Picture 
  CmdEdit.Picture = ImgLst.ListImages(8).Picture 
  CmdNew.ToolTipText = "添加题目" 
  CmdEdit.ToolTipText = "编辑题目" 
 End If 
  
End Sub 
 
Private Sub CmdNew_Click() 
 If CmdNew.ToolTipText = "添加题目" Then 
  SetEnabled True 
  CmdNew.Picture = ImgLst.ListImages(5).Picture 
  CmdEdit.Picture = ImgLst.ListImages(6).Picture 
  CmdNew.ToolTipText = "保存题目" 
  CmdEdit.ToolTipText = "取消保存" 
  NewOrEdit = "New" 
 Else 
   
    '判断输入时候合格 
    If CheckIn = False Then 
       Exit Sub 
    End If 
    Dim SQL As String 
    Dim KemuStr As String, XuanZeStr As String, NianJiStr As String, NanDuStr As String, DaanStr As String 
    Dim i As Integer 
    KemuStr = CmbKeMu.Text 
    NianJiStr = CmbNianJi.Text 
    NanDuStr = CmbNanDu.Text 
    XuanZeStr = "" 
    '得到选择项 
    For i = 0 To Val(CmbGS.Text) - 2 
      XuanZeStr = XuanZeStr + TxTXuanZe(i) + "||" 
    Next i 
    XuanZeStr = XuanZeStr + TxTXuanZe(i) 
    '得到答案 
    DaanStr = GetDaan() 
    '判断是添加还是编辑 
    If NewOrEdit = "New" Then 
      SQL = "insert into question(kemu,wenti,xuanze,daan,nianji,image,nandu,author) values ('" 
      SQL = SQL + KemuStr + "','" + TxTTM + "','" + XuanZeStr + "','" + DaanStr + "','" + NianJiStr + "',NULL,'" + NanDuStr + "','00')" 
      DB.Execute SQL 
      'MsgBox SQL 
    '添加节点 
    'Dim NewNod As Node 
    'Set NewNod = TrVKemu.Nodes.Add("node_nd" + KemuStr + NianJiStr + NanDuStr, tvwChild, "N" + Str(adoQuestionRs.Fields(0).Value), "第" + Str(Number) + "题") 
    Else 
      '更新 
      '用CmdNew控件的Tag属性保存题目ID 
      SQL = "update question set kemu='" + KemuStr + "',wenti='" + TxTTM + "',xuanze='" + XuanZeStr + "',daan='" + DaanStr + "',nianji='" + NianJiStr + "',image=NULL,nandu='" + NanDuStr + "' where id=" + CmdNew.Tag 
      DB.Execute SQL 
    End If 
   
  SetEnabled False 
  CmdNew.Picture = ImgLst.ListImages(7).Picture 
  CmdEdit.Picture = ImgLst.ListImages(8).Picture 
  CmdNew.ToolTipText = "添加题目" 
  CmdEdit.ToolTipText = "编辑题目" 
 End If 
End Sub 
 
Private Sub Form_Load() 
  Dim MyNod As Node 
  ', Mynod1 As Node 
  Dim NewNod As Node 
  ', NewNod1 As Node 
  Dim MySql As String 
  Dim KemuStr As String, NianJiStr As String, NanDuStr As String 
  Dim adoKemuRs As Recordset 
  'dim adoQuestionRs As Recordset 
  Dim SQL As String 
  '年级 
  Dim NianJi(1 To 5) As String 
  '难度 
  Dim NanDu(1 To 3) As String 
  Dim i As Integer 
  Dim j As Integer 
  '赋值 
  NianJi(1) = "一年级" 
  NianJi(2) = "二年级" 
  NianJi(3) = "三年级" 
  NianJi(4) = "四年级" 
  NianJi(5) = "五年级" 
  NanDu(1) = "低" 
  NanDu(2) = "中" 
  NanDu(3) = "高" 
   
'打开记录集 
  Set adoKemuRs = New Recordset 
  'Set adoQuestionRs = New Recordset 
  adoKemuRs.Open "select * from kemu", DB, adOpenStatic, adLockOptimistic 
 '建立根接点 
  Set MyNod = TrVKemu.Nodes.Add(, , "node_m", "题目种类", "question") 
  '建立科目节点 
  adoKemuRs.MoveFirst 
  Do While Not adoKemuRs.EOF 
   KemuStr = adoKemuRs.Fields(1).Value 
   '给CmbKeMu控件添加项 
   CmbKeMu.AddItem KemuStr 
   Set NewNod = TrVKemu.Nodes.Add("node_m", tvwChild, "node_km|" + KemuStr, KemuStr) 
   NewNod.Image = "kemu" 
   NewNod.ExpandedImage = "kemu" 
   '建立年级节点 
   For i = 1 To 5 
     NianJiStr = KemuStr + "|" + NianJi(i) 
     Set NewNod = TrVKemu.Nodes.Add("node_km|" + KemuStr, tvwChild, "node_nj|" + NianJiStr, NianJi(i)) 
     NewNod.Image = "nianji" 
     NewNod.ExpandedImage = "nianji" 
     '建立难度节点 
     For j = 1 To 3 
       NanDuStr = NanDu(j) 
       Set NewNod = TrVKemu.Nodes.Add("node_nj|" + NianJiStr, tvwChild, "node_nd|" + KemuStr + "|" + NianJi(i) + "|" + NanDu(j), NanDu(j)) 
       NewNod.Image = "nandu" 
       NewNod.ExpandedImage = "nanduopen" 
       '建立题目节点 
       'SQL = "select id from question where kemu='" + KemuStr + "' and nianji='" + NianJi(i) + "' and nandu='" + NanDu(j) + "'" 
       'adoQuestionRs.Open SQL, DB, adOpenStatic, adLockOptimistic 
       'Dim Number As Long 
       'Number = 0 
      ' Do While Not adoQuestionRs.EOF 
      '    Number = Number + 1 
      ''    Set NewNod = TrVKemu.Nodes.Add("node_nd|" + KemuStr + "|" + NianJi(i) + "|" + NanDu(j), tvwChild, "N" + Str(adoQuestionRs.Fields(0).Value), "第" + Trim(Str(Number)) + "题(" + Trim(Str(adoQuestionRs.Fields(0).Value)) + ")") 
       '   adoQuestionRs.MoveNext 
      ' Loop 
     '  adoQuestionRs.Close 
     Next j 
   Next i 
   adoKemuRs.MoveNext 
  Loop 
 '产生选择项 
 CreateXuanZe 
 '设置控件可否编辑 
 SetEnabled False 
 '位置 
TrVKemu.Width = 3270 
 
End Sub 
 
Private Sub Frame2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 
     ImgCheck.Picture = ImgLst.ListImages(1).Picture 
     ImgDel.Picture = ImgLst.ListImages(3).Picture 
End Sub 
 
Private Sub FrmDA_DragDrop(Source As Control, X As Single, Y As Single) 
 
End Sub 
 
Private Sub ImgCheck_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 
      ImgCheck.Picture = ImgLst.ListImages(4).Picture 
 
End Sub 
 
 
 
Private Sub ImgDel_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 
   ImgDel.Picture = ImgLst.ListImages(2).Picture 
End Sub 
 
 
 
Private Sub TrVKemu_Collapse(ByVal Node As MSComctlLib.Node) 
    TrVKemu.Width = 3270 
 
End Sub 
 
Private Sub TrVKemu_Expand(ByVal Node As MSComctlLib.Node) 
  'MsgBox Node.Children 
   '设置对应的cmbkemu和cmbnianji,cmbnandu控件 
 
  If Left(Node.Key, 7) = "node_km" Then 
      SetCmbText Node.Text, CmbKeMu 
      Exit Sub 
  End If 
  If Left(Node.Key, 7) = "node_nj" Then 
      SetCmbText Node.Text, CmbNianJi 
      Exit Sub 
  End If 
End Sub 
 
Private Sub TrVKemu_NodeClick(ByVal Node As MSComctlLib.Node) 
   'MsgBox Node.Children 
   '设置对应的cmbkemu和cmbnianji,cmbnandu控件 
   'MsgBox Node.Children 
   '底层 
   If Left(Node.Key, 7) = "node_nd" Then 
       SetCmbText Node.Text, CmbNanDu 
       '打开节点 
       Dim adoQuestionRs As Recordset 
       Dim StrArr() As String 
       StrArr = Split(Node.Key, "|") 
       Set adoQuestionRs = New Recordset 
       SQL = "select id from question where kemu='" + StrArr(1) + "' and nianji='" + StrArr(2) + "' and nandu='" + StrArr(3) + "'" 
       adoQuestionRs.Open SQL, DB, adOpenStatic, adLockOptimistic 
       List1.Clear 
       Do While Not adoQuestionRs.EOF 
          List1.AddItem "第" + Trim(Str(adoQuestionRs.Fields(0).Value)) + "题" 
          adoQuestionRs.MoveNext 
       Loop 
       adoQuestionRs.Close 
       TrVKemu.Width = 2265 
        
  End If 
   
   Dim Pid As Long 
   If Node.Children = 0 And Left(Node.Key, 1) = "N" Then 
       Pid = Val(Right(Node.Key, Len(Node.Key) - 2)) 
       '查询显示 
       Dim adoTMRs As Recordset 
       'Dim SQL As String 
       Set adoTMRs = New Recordset 
       SQL = "select * from question where id=" + Str(Pid) 
       adoTMRs.Open SQL, DB, adOpenStatic, adLockOptimistic 
       PlayTM adoTMRs 
       adoTMRs.Close 
   Else 
      SetCmbText Node.Text, CmbNanDu 
   End If 
 
End Sub 
Sub SetCmbText(ByVal Str As String, ByVal CmbBox As ComboBox) 
  '查找对应项 
  Dim i As Integer 
  For i = 0 To CmbBox.ListCount - 1 
    If Str = CmbBox.List(i) Then CmbBox.ListIndex = i 
  Next i 
   
End Sub 
Private Sub VSXuanZe_Change() 
 
 PicXuanZe.Top = -1 * VSXuanZe.Value 
End Sub 
'设置控件是否可以编辑 
Sub SetEnabled(ByVal TF As Boolean) 
  Dim i As Integer 
  CmbKeMu.Enabled = TF 
  CmbNianJi.Enabled = TF 
  CmbNanDu.Enabled = TF 
  CmbGS.Enabled = TF 
  TxTTM.Locked = Not TF 
  For i = 0 To 9 
     TxTXuanZe(i).Locked = Not TF 
  Next i 
  FrmeDA.Enabled = TF 
  FrmeMove.Enabled = Not TF 
  CmdDel.Enabled = Not TF 
End Sub 
'得到答案字符串 
Function GetDaan() As String 
  Dim i As Integer 
  Dim Str As String 
  For i = 0 To Val(CmbGS.Text) - 1 
    If CheDaAn(i).Value = 1 Then 
       Str = Str + Chr(65 + i) + "|" 
    End If 
  Next i 
  If Str <> "" Then Str = Left(Str, Len(Str) - 1) 
  GetDaan = Str 
End Function 
'检查输入时候合格 
Function CheckIn() As Boolean 
   CheckIn = True 
   Dim i As Integer 
   If Trim(TxTTM) = "" Then 
      CheckIn = False 
      MsgBox "请把题目填写完整!", 48, "提示!" 
      Exit Function 
   End If 
   For i = 0 To Val(CmbGS.Text) - 1 
     If Trim(TxTXuanZe(i)) = "" Then 
          CheckIn = False 
          MsgBox "请把选择项填写完整!", 48, "提示" 
          TxTXuanZe(i).SetFocus 
          Exit Function 
     End If 
   Next i 
   If GetDaan() = "" Then 
     CheckIn = False 
     MsgBox "请选择该题目的正确答案,以便电脑判卷!", 48, "提示" 
   End If 
End Function 
'显示题目模块 
Sub PlayTM(ByVal tmRS As Recordset) 
   Dim XuanzeArr() As String 
   Dim i As Integer 
   SetCmbText tmRS.Fields("kemu"), CmbKeMu 
   SetCmbText tmRS.Fields("nianji"), CmbNianJi 
   SetCmbText tmRS.Fields("nandu"), CmbNanDu 
   TxTTM.Text = tmRS.Fields("wenti") 
   CmdNew.Tag = tmRS.Fields("id") 
   XuanzeArr = Split(tmRS.Fields("xuanze"), "||") 
   For i = 0 To 3 
     TxTXuanZe(i).Text = XuanzeArr(i) 
   Next i 
    
End Sub