【正确答案】正确答案: (1)计时器控件的Interval属性是用来控制计时器事件发生的时间间隔,通过题意可知该属性应设置为1 000(Interval是以毫秒为单位)。当单击“出发”按钮时开始计时,把计时器控件的Enabled属性设置为True。 根据题意,将两个图片控件、一个计时器控件和一个命令按钮添加到窗体中,Picture的名称为Picl和Pic2,Pic1的背景色为黑色,Pic2的背景色为红色,计时器的Interval属性为1 000,名称为Timerl,Enable属性为False,命令按钮的名称为Commandl,Caption属性为“出发”,双击Commandl进入代码窗口,补充后的具体代码如下: Private Sub Command1_Click() Timerl.
Enabled
=True End Sub Private Sub Timerl_Timer() Dim sp As Integer sp=200 '运动速度 If Picl.
Left
+Picl.
Width
>=Pic2.
Left
Then sp=0 End If Picl.
Left
=Picl.
Left
+sp'Picl的位置变化 End Sub 单击

按钮运行程序,并按要求保存。 (2)在文本框中显示的内容通过文本框的Text属性设置。复选按钮和单选按钮的状态用Value属性来表示。对于单选按钮来说,Value属性可设置为True或False,当设置为True时表示被选中的,否则表示没有选中。对于复选按钮来说,Value属性可以设置为0、1或2。其中:0表示没有选中该复选按钮;1表示选中该复选按钮;2表示该复选按钮被禁止(灰色)。 根据题意,将两个单选按钮控件、两个复选按钮、一个文本框控件和一个命令按钮添加到窗体中,单选按钮的名称分别为Optionl和Option2、Caption属性为“Iteml”和“Item2”,复选按钮的名称分别为Checkl和Check2,Caption属性分别为“Item3”和“Item4”,文本框的名称为Textl、Caption属性为空,命令按钮的名称为Commandl、Caption属性为“输出”。双击Commandl进入代码编写窗IZl,利用字符串相加和If—else语句设计程序,具体代码如下: Private Sub Commandl_Click() Dim str As String Dim trnp As String str="" If Optionl.
Value
=True Then'选中Optionl str=str+"Iteml包括" Else'选中Option2 str=str+"Item2包括" End If If
Checkl.Value
=0 Then'没选中Checkl If Check2.
Value
=1 Then '选中Cheek2 tmp=Check2.
Caption
str=str+tmp End If Else'选中Checkl If
Check2.Value
=0 Then '没选中Check2 tmp=Checkl.
Caption
str=str+trap Else'选Check2 tmp=Checkl.Caption str=str+tmp str=str+"和" tmp=Check2.
Caption
str=str+tmp End If End If Textl.
Text
=str End Sub 单击
