We recommend using Visual Studio 2017

Step 9: Try Other Features


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Step 9: Try Other Features.

To learn more, try changing icons and colors, adding a game timer, and adding sounds. To make the game more challenging, try making the board bigger and adjusting the timer.

To download a completed version of the sample, see Complete Matching Game tutorial sample.

To try other features

  • Replace the icons and colors with ones you choose.

    System_CAPS_ICON_tip.jpg Tip

    Try looking at the label's Forecolor property.

  • Add a game timer that tracks how long it takes for the player to win.

    System_CAPS_ICON_tip.jpg Tip

    To do this, you can add a label to display the elapsed time on the form above the TableLayoutPanel, and add another timer to the form to track the time. Use code to start the timer when the player starts the game, and stop the timer after they match the last two icons.

  • Add a sound when the player finds a match, another sound when the player uncovers two icons that don't match, and a third sound when the program hides the icons again.

    System_CAPS_ICON_tip.jpg Tip

    To play sounds, you can use the System.media namespace. See Play Sounds in Windows Forms App (C# .NET) or How To Play Audio In Visual Basic for more information.

  • Make the game more difficult by making the board bigger.

    System_CAPS_ICON_tip.jpg Tip

    You'll need to do more than just add rows and columns to the TableLayoutPanel – you'll also need to consider the number of icons you create.

  • Make the game more challenging by hiding the first icon if the player is too slow to respond and doesn't choose the second icon before a certain amount of time.

To continue or review