修改该 VB 程序,使其具有下列功能。 图 2-1 图 2-2 图 2-3 打开 “试题二“文件夹中的工程文件“ test2.vbp ”,完成下列操作: 1. ( 4 分)设置两个文本框文字居中显示。 修改列表框显示为带复选框的格式,如图 2-1 所示。 2. ( 14 分,每空 3 分)单击 “添加”按钮,把文本框 1 的内容添加到 List1 中文本框 2 指定的位置,同时选中新添加的项,清空两个文本框内容,光标定位到文本框 1 。如果添加内容为空,或者指定位置超过列表框项数,则不添加。效果如图 2-2、图2-3所示。 将代码中的 1、2、3、4填写完整,实现该程序功能。 3.(3分)单击“删除”按钮,把列表框中选中的项删除 。 将代码中的 空 5填写完整,实现该程序功能。 4.(3分)单击“全部删除”按钮,删除列表框中所有的项。 将代码中的 空 6填写完整,实现该程序功能。 5. ( 1 分)保存窗体文件和工程文件,生成可执行程序 “ Test2.exe ”并保存到考生文件夹下的“试题二”文件夹中。 Private Sub Command1_Click() If Text1.Text <> "" And Text2.Text <> "" Then wz = Val(Text2.Text) If Then Exit Sub ’ 1 List1.AddItem ‘ 2 For i = 0 To List1.ListCount - 1 List1.Selected(i) = False Next i = True ' 3 Text1.Text = "" Text2.Text = "" ' 4 End If End Sub Private Sub Command2_Click() For i = ‘ 5 If List1.Selected(i) = True Then List1.RemoveItem i End If Next i End Sub Private Sub Command3_Click() ' 6 End Sub