Game Sample

To get samples and instructions for installing them, see the following:

  • Click Samples on the Visual Studio Help menu.

    For more information, see Locating Sample Files.

  • The most recent versions and the complete list of samples are available on the Visual Studio 2008 Samples Web site.

  • You can also locate samples on your computer's hard disk. By default, samples and a Readme file are copied to a folder under \Program Files\Visual Studio 9\Samples\. For Visual Studio Express Editions, all samples are located on the Internet.

To view the sample documentation

  1. In Solution Explorer, double-click the Documentation folder.

  2. If you are using Visual Basic Express Edition, right-click ReadMe.htm in the Documentation folder. Select View in Browser.

  3. If you are using another version of Visual Basic, double-click ReadMe.htm in the Documentation folder.

Demonstrates

This sample demonstrates features that are implemented in most applications:

  • User options   The Options form enables users to reset the high scores and turn sound on and off.

  • Help   The application includes a compiled Help project. The compiled Help is accessed through the Help menu item.

  • Mouse   The mouse is used not only to play the game, but to drag the form around when the title bar is hidden.

  • Keyboard   The "M" key toggles the menu and title bar on and off. The "P" key pauses and restarts the game action.

Several Visual Basic and .NET Framework features are highlighted:

  • GDI+ graphics   The game action is implemented by using drawing functions from the System.Drawing namespace.

  • Registry   High scores are stored in the registry.

  • Object-oriented programming   The game action and drawing is controlled by several classes that act together. The main game classes are the Grid and Block classes. The PointTranslator class adds utility functions for drawing the blocks. The HighScores class handles retrieving and setting scores.