Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void easterEgg_fallDown(Object myObj)
- {
- Control currentControl = (Control)myObj;
- Random rand = new Random();
- rand.Next(10, 200);
- Point newLoc = new Point();
- while (currentControl.Location.Y < Size.Height)
- {
- newLoc.X = currentControl.Location.X + rand.Next(-5, 5);
- newLoc.Y = currentControl.Location.Y + 1;
- if (newLoc.X < 0)
- newLoc.X = 0;
- try
- {
- currentControl.Location = newLoc;
- }
- catch (Exception)
- {
- }
- Thread.Sleep(1);
- }
- Refresh();
- threadCount--;
- }
- private void easterEgg(Control currentControl)
- {
- foreach (Control aControl in currentControl.Controls)
- {
- if (aControl is GroupBox)
- {
- easterEgg(aControl);
- }
- else if (aControl is ListBox)
- {
- while (((ListBox)aControl).Items.Count > 0)
- {
- ((ListBox)aControl).Items.RemoveAt(0);
- }
- }
- threadCount++;
- Thread mythread = new Thread(new ParameterizedThreadStart(easterEgg_fallDown));
- mythread.Start(aControl);
- EasterEggThreads.Add(mythread);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement