中国护理管理杂志社:vb编程题目

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/10 06:35:44
2、设窗体中有image1:蝴蝶展开翅膀图,image2:蝴蝶合上翅膀图,image3;timer1:定时器,timer1每秒触发一次,改变image3的图象,并使它每次位置x+10,y+10,当x超出屏幕宽度时,将位置中的x改为0。
A、写出timer1_timer中的程序设计思想 (10分)
B、写出timer1_timer中的程序代码 (15分)

以下代码仅作参考:

Private Sub Timer_timer()
Static Opened as Boolean
opended=not opened
if opened then
image3.picture=image1.picture
else
image3.picture=image2.picture
end if
image3.left=image3.left+10
image3.top=image3.top+10
if image3.left>screen.width then image3.left=0
if image3.top>screem.height then image3.top=0
End Sub

程序思路:
Opened是用来表示图片状态的静态变量
True表示开
False表示闭
每个一定时间更改状态(更换图片)
移动文件
如果超过范围,设为0

这我都做了好多次了

不是吧你,这也问