【正确答案】【操作步骤】 步骤1:打开本题工程文件。
步骤2:打开代码编辑窗口,去掉程序中的注释符“'”,将问号改为正确的内容。
参考答案(字体加粗部分是需考生填入的内容)
Dim d As Integer
Private Sub Command1_Click()
Timer1.Enabled=True '当单击"开始"按钮时,Timer生效
End Sub
Private Sub Command2_Click()
Timer1.Enabled=False '当单击"停止"按钮时,Timer失效
End Sub
Private Sub Form_Load()
d=1
End Sub
Private Sub Timer1_Timer()
If Option1 Then '判断Option1是否被单击
Shape2.Top=
Shape2.Top+d*50 '实现圆垂直移动
If Shape2.Top<=Shape1.
Top Or Shape2.Top+Shape2.Width>=Shape1.Top+Shape1.Height Then '判断Shape2与Shape1的位置
d=-d '当圆移出Shape1时,改变移动方向
End If
ElseIf Option2 Then
Shape2.Left=
Shape2.Left+d*50 '实现水平移动
If Shape2.Left<=Shape1.Left Or Shape2.Left+Shape2.Width>=Shape1.Left+Shape1.Width Then
d=-d '当圆移出Shape1时,则改变移动方向
End If
End If
End Sub
步骤3:调试并运行程序,关闭程序后按题目要求存盘。