单选题 窗体上有1个Timer1计时器,1个Shape1形状控件,还有下面程序代码:Dim flag As Boolean Private Sub Timer1_Timer()Private Sub Form_Load() If flag Thenflag=True Shape1.Height=Shape1.Height*2Timer1.Enabled=True Shape1.Width=Shape1.Width*2Timer1.Interval=1000 ElseEnd Sub Shape1.Height=Shape1.Height*0.5Shape1.Width=Shape1.Width*0.5End Ifflag=Not flagEnd Sub执行程序所产生的效果是
【正确答案】 B
【答案解析】解析:在计时器事件中会判断窗体级交量flag的值,如果为真则形状尺寸扩大一倍,否则缩小到一半。由于第一次开始计时器事件的时候flag的值为True,所以首先会将形状扩大一倍,然后第二次计时器事件将形状恢复原状。