Tag Archives: resources

Play an audio resource in C#

The System.Media.SoundPlayer class lets you easily play a WAV file stored as an audio resource. For this example, first add the WAV file as an audio resource. To do that, open the Project menu and select Properties. Then open the … Continue reading

Posted in audio, multimedia | Tagged , , , , , , , , , , , , , | 1 Comment

Play WAV files in C#

The System.Media.SoundPlayer class lets you easily play WAV files. This example uses the following PlayWav method to play WAV files. // The player making the current sound. private SoundPlayer Player = null; // Dispose of the current player and // … Continue reading

Posted in audio, files, multimedia | Tagged , , , , , , , , , , , , , | Leave a comment

Use a string collection setting in C#

A program’s settings can include many data types such as int, char, DateTime, and Color. If you want to be able to hold a list of strings, you can make a setting that has type StringCollection. To create such a … Continue reading

Posted in settings | Tagged , , , , , , , , , | 1 Comment

Use vectors to manage bouncing balls in C#

This example is similar to the one Use sprites to animate several bouncing balls in C# except it uses vectors to store information about the balls. A vector is a direction represented by X and Y coordinates. For example, the … Continue reading

Posted in algorithms, animation, audio, geometry, graphics, multimedia | Tagged , , , , , , , , , , , , , , , , , , , | Leave a comment

Use sprites to animate several bouncing balls in C#

This example is similar to the one described in the post Animate several bouncing balls in C# except it uses sprites to control the balls. The previous example stores the ball data in a group of arrays. This approach works … Continue reading

Posted in algorithms, animation, audio, graphics, multimedia | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Animate several bouncing balls in C#

This example modifies the earlier post Make a bouncing ball animation in C# to animate several bouncing balls. Much of the basic idea is the same so see that example first. The big difference is that this version stores ball … Continue reading

Posted in animation, audio, graphics, multimedia | Tagged , , , , , , , , , , , , , | 3 Comments

Make a bouncing ball animation in C#

This example shows how to make a bounding ball animation. When the form loads, the following code executes. // Some drawing parameters. private const int BallWidth = 50; private const int BallHeight = 50; private int BallX, BallY; // Position. … Continue reading

Posted in animation, audio, multimedia | Tagged , , , , , , , , , , , , | 4 Comments

Draw text filled with a picture in C#

This example shows how you can draw text filled with a picture. It uses two images added to the project as resources. (To add resources to the project, open the Project menu and select the Properties command at the very … Continue reading

Posted in drawing, fonts, graphics, strings | Tagged , , , , , , , , , , , , | Leave a comment

Use resources to hold images, text, and other data, and load it at run time in C#

Resources are images, strings, text files, and other pieces of data that you can build into an application. Your program can load the resources at run time to display new pictures, text, or whatever. To add resources to the project, … Continue reading

Posted in controls, graphics, strings | Tagged , , , , , , , , , , | Leave a comment