Hack Forums
[.NET] Rain Drop Simulation - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Rain Drop Simulation (/showthread.php?tid=5715986)



Rain Drop Simulation - makeitgoaway - Sep 11, 2017

Hello,

I am trying to make a raindrop simulation with a slider:

The program will be as simple as this:

The slider will go from 0 to 1000 (the amount of rain drops present). The user will be able to change this. Then, the amount of drops will be going from top to bottom at a certain interval.

Code
randomize()
For i = 0 to slider.value
Dim pb As New PictureBox
pb.Width = 25
pb.Height = 25
pb.ImageLocation = "raindrop.png"
pb.Top = Me.Height * Rnd()
picturebox1.left = Me.Width * Rnd()
Me.Controls.Add(pb)
next

I have only tested this so far and it is extremely slow! Anytime the user selects a number above 50, the form just freezes. Is there a better way to do this?

Please advise.


* - HFDone - Sep 12, 2017

snow drop https://hackforums.net/showthread.php?tid=3964747