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

📄 form1.frm

📁 Visual Basic程序设计基础》-杨小影-源代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "计算机系04级第三学期专业选修课程"
   ClientHeight    =   4125
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6510
   LinkTopic       =   "Form1"
   ScaleHeight     =   4125
   ScaleWidth      =   6510
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command5 
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4680
      TabIndex        =   8
      Top             =   3600
      Width           =   975
   End
   Begin VB.CommandButton Command4 
      Caption         =   "统计"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1440
      TabIndex        =   7
      Top             =   3600
      Width           =   975
   End
   Begin VB.CommandButton Command3 
      Caption         =   "删除"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3120
      TabIndex        =   6
      Top             =   3600
      Width           =   975
   End
   Begin VB.CommandButton Command2 
      Caption         =   ">>"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   500
      Left            =   3000
      TabIndex        =   5
      ToolTipText     =   "全选"
      Top             =   2400
      Width           =   500
   End
   Begin VB.CommandButton Command1 
      Caption         =   ">"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   500
      Left            =   3000
      TabIndex        =   4
      ToolTipText     =   "选择课程"
      Top             =   1320
      Width           =   500
   End
   Begin VB.ListBox List2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2460
      ItemData        =   "Form1.frx":0000
      Left            =   3720
      List            =   "Form1.frx":0002
      TabIndex        =   1
      Top             =   960
      Width           =   2655
   End
   Begin VB.ListBox List1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2460
      ItemData        =   "Form1.frx":0004
      Left            =   120
      List            =   "Form1.frx":0006
      TabIndex        =   0
      Top             =   960
      Width           =   2655
   End
   Begin VB.Label Label2 
      Caption         =   "选修课程"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   4320
      TabIndex        =   3
      Top             =   240
      Width           =   1575
   End
   Begin VB.Label Label1 
      Caption         =   "开设课程"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   480
      TabIndex        =   2
      Top             =   240
      Width           =   1575
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()                     '单击 > 按钮
Dim i%, j%
j = List2.ListCount                              '统计右边列表框中项目数量
If List1.Text <> "" Then                         '查找右边列表框中是否已有现在选中的列表项
  For i = 0 To j - 1
    If List2.List(i) = List1.Text Then Exit For  '有则不再添加
  Next i
  If i = j Then List2.AddItem List1.Text         '没有则在右边列表框中添加左边列表框内选中的项目
End If
End Sub

Private Sub Command2_Click()                     '单击 >> 按钮
Dim i%
List2.Clear
For i = 0 To List1.ListCount - 1                 '全部添加左边列表框的项目
    List2.AddItem List1.List(i)
Next i

End Sub

Private Sub Command3_Click()                     '单击删除按钮
If List2.Text <> "" Then
 List2.RemoveItem List2.ListIndex
End If


End Sub

Private Sub Command4_Click()                     '单击统计按钮
Dim i%
i = List2.ListCount
MsgBox "你共选修了" & i & "门专业课程!"         '统计所选修的门数
End Sub

Private Sub Command5_Click()
End
End Sub

Private Sub Form_Load()                          '初始化数据
With List1                                       '给列表框添加数据项
     .AddItem "Java程序设计"
     .AddItem "组成原理与汇编语言"
     .AddItem "数据结构"
     .AddItem "计算机网络原理"
     .AddItem "信息管理学概论"
     .AddItem "计算机组装与维护"
     .AddItem "实用多媒体技术"
     .AddItem "专业英语"
     .AddItem "Dreamweaver"
     .AddItem "Vc++"
     .AddItem "VF"
End With
End Sub

Private Sub List1_DblClick()
Dim i%, j%
j = List2.ListCount
If List1.Text <> "" Then
 For i = 0 To j - 1
   If List2.List(i) = List1.Text Then Exit For
 Next i
If i = j Then List2.AddItem List1.Text
End If
End Sub

⌨️ 快捷键说明

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