by Sothern Cracker (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 14th August 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
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
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
No comments have been posted about This code makes it snow or rain on your form by drawing circles. Why not be the first to post a comment about This code makes it snow or rain on your form by drawing circles.