试题与答案

[说明] 已有一个工程文件,窗体上有两个图片框,名称为P1,P2。分别用来表示信号灯

题型:填空题

题目:

[说明] 已有一个工程文件,窗体上有两个图片框,名称为P1,P2。分别用来表示信号灯合汽车,其中在P1中轮流装入“黄灯.ico”、“红灯.ico”、“绿灯.ico”文件来实现信号灯的切换;还有两个计时器 Timer1 和Timer2,Timer1 用于变换信号灯,黄灯1秒,红灯2秒,绿灯3秒;Timer2用于控制汽车向左移动。运动时,信号灯不断变换,单击“开车”按钮后,汽车开始移动,如果移动到信号灯前或信号灯下,遇到红灯或黄灯,则停止移动。下面是实现上述功能的程序,请填空。 Private Sub Timer41_ Timer() a=a+1 If (1) Then a=1 End If Select Case aCase 1 P1. Picture = LoadPicture( “黄灯.ico” )Case 2, 3 P1. Picture = LoadPicture( “红灯”.ico” )Case4, 5, 6 P1. Picture = LeadPicture( “绿灯. ico” ) (2) End Select End Sub Private Sub Timer2_Timer( ) If (3) And (P2. Left > P1. Left And P2. Left < P1. Left + P1. Width) Or P2. Left < = 100 ThenTimer2. Enabled = False Else (4) End If End Sub

答案:

参考答案:a>6

解析:If b Then Timer2. Enabled =b (a (4) P2. Move P2. Left - 10, P2. Top, P2. Width, P2. Height

试题推荐
微信公众账号搜索答案