窗体布局:
控件 | 屬 性 | 值 |
| timer1 | enabled | flase |
| interval | 1 | |
| command1 | caption | 画图 |
| command2 | caption | 保存 |
commondialog1 ,各屬性不用改变。
代码:
dim i as integer
dim a as integer
dim b as single
private sub command1_click()
timer1.enabled = true
end sub
private sub command2_click()
me.autoredraw = false
commondialog1.filter = "bitmap(*.bmp)|*.bmp"
commondialog1.showsave
if commondialog1.filename <> "" then
savepicture me.image, commondialog1.filename
end if
end sub
private sub form_load()
i = 0
a = 0
b = 0
end sub
private sub timer1_timer()
i = i + 1
a = a + 5
line (4000, 1800 + a)-(7000, 1800 + a), rgb(0, abs(255 - a / 10), 0)
line (4000 + a, 1800 - a)-(7000 + a, 1800 - a), rgb(0, abs(255 - a / 10), 0)
line (7000 + a, 1800 - a)-(7000 + a, 3800 - a), rgb(0, abs(255 - a / 10), 0)
if a > 2000 then timer1.enabled = false
circle (2000, 6000 - a), 1500, rgb(0, 0, abs(255 - a / 10)), , , 0.4
circle (9000, 6000 - a), 1500 - a / 2.5, rgb(abs(255 - a / 10), 0, 0), , , 0.4
for b = 0 to 40 step 0.1
pset (3000 + 100 * b, 5000 - 300 * sin(b)), rgb(abs(255 - a / 10), abs(255 - a / 10), 0)
next
end sub