窗体布局:
控件
屬 性
值
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