1. Home
  2. Computing & Technology
  3. Delphi Programming
Drawing Snowflakes All Over your Desktop Screen
It's time for a little winter joy! Amaze your co-workers: *Snowflakes* application randomly draws and moves snowflake images over your Desktop screen. While having some fun, learn how to create transparent, top-most and caption-less forms that randomly move over your screen.
 More of this Feature
• DOWNLOAD SOURCE CODE
 Join the Discussion
"Post your views, comments, questions and doubts to this article."
Discuss!
 Related Resources
• Form related articles and tricks
• Weird shaped and transparent forms

Stop! Working hard? Deadline approaching? Look outside your window, is it snowing? Look at your Desktop: it is snowing ;)

It's winter time!
If it is not, let's pretend that it is!

I present you the one-and-only, have-fun-while-working-overtime, snowflakes-all-over-your-Desktop screen, full source code Delphi application.

Here's the recipe to amaze yourself and your coworkers (time required: 15 minutes):

  • Let there be a main form (name: "MainSnowFlake") in a Delphi application.
  • Hide the main form from the user by setting "Application.ShowMainForm := False;"
  • Remove the button from the TaskBar.
  • Turn this "program" into a System Tray Application.
  • Add one more form (name: "SnowFlakeForm") to the project, remove it from the "Auto-create forms" list.
  • Add a label to the SnowFlakeForm. Use a font with snowflake images.
  • Play with CreateParams to make this form transparent, top-most, with no title bar. So that only the snowflake "image" remains visible.
  • Add a timer (TTimer) to the SnowFlakeForm and let it randomly move the form over the Desktop screen in the OnTime event.
  • Add a popup menu for the MainSnowFlake form. Popup will feature an "Add snowflake" and an "Exit" item.
  • When the application starts, randomly draw 10 (you pick the number) snawflakes all over the Desktop.
  • Have fun while exploring the full source code.

Delphi draws snowflakes...

Note: this is not a perfect application. It would be better to use an image of the snowflake to create a true transparent form. Yes, this would require some more coding ... and the deadline for your money-making-application is around the corner.

Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.