This code makes it snow or rain on your form by drawing circles
This code makes it snow or rain on your form by drawing circles
API Declarations
Private Type Flake
X As Long
Y As Long
MoveX As Long
MoveY As Long
Size As Long
End Type
'to change how many flakes just change snowcount
Const SnowCount As Single = 100
Dim Snow(SnowCount) As Flake
Rate This code makes it snow or rain on your form by drawing circles
(1(1 Vote))
Me.ScaleMode = 3
Me.AutoRedraw = True
Timer1.Interval = 1
For i = 0 To SnowCount
Snow(i).X = (Me.ScaleWidth * Rnd)
Snow(i).Y = (Me.ScaleWidth * Rnd)
Snow(i).MoveX = (2 * Rnd) + 2
Snow(i).MoveY = (2 * Rnd) + 3
Snow(i).Size = (3 * Rnd)
Next i
End Sub
Private Sub Timer1_Timer()
Me.Cls
For i = 0 To SnowCount
Snow(i).X = (Snow(i).X Mod Me.ScaleWidth) + Snow(i).MoveX
Snow(i).Y = (Snow(i).Y Mod Me.ScaleHeight) + Snow(i).MoveY
Circle (Snow(i).X, Snow(i).Y), Snow(i).Size, vbWhite
'To make it rain just add this int the place of vbWhite -- vbBlue, 1, 0, 2
Next i
Me.Refresh
End Sub
This code makes it snow or rain on your form by drawing circles Comments
No comments yet — be the first to post one!
Post a Comment