Click here to Skip to main content
15,868,016 members
Articles / Programming Languages / C#
Article

.NET Audio buttons with professional look

Rate me:
Please Sign up or sign in to vote.
1.35/5 (25 votes)
10 Aug 20032 min read 66K   1.4K   26   5
.NET buttons that used for audio functions - write your own control

Sample Image - AudioButtons.jpg

Introduction

When I wrote a program to play audio files (.wav, mp3) I need add some buttons for playing audio files. Unfortunately, .NET doesn’t have such buttons. As part of study on how to write my own controls, I create these audio buttons including Play, Pause, Rewind, Forward, Stop, ToEnd, ToStart. User can use them just as they are using the standard buttons supplied by VS .NET.

Using the code

Here is one example of how to use the code: <o:p>

1.      Use the project in your own solution: Download the source code, which is a project itself. Unzipped it into your solution folder (this would be better, but you can save them wherever you like) In your Solution Explorer in VS .NET, right click the solution and choose “Add”  and “existing project…”. Choose AudioControls project from where ever you unzipped it, then click Open.<o:p>

2.      Add the AudioControls project as a reference to your own project: Right click your own project other than AudioControls project in Solution Explorer, choose “Add reference …” Then click the tab “Projects”, choose the project the click “Select”, then “OK”.<o:p>

3.      Add AudioButtons into your toolbox: At design mode, click your “Toolbox” and choose one of the tab (say My User Controls or whichever group you want the audiobuttons appear in) Right click the toolbox and choose “Add/Removing Items….” In “.NET Framework Components” tab click “Browse…”, in the new window browse for “AudioButtons.dll”, (normally should be under \bin\debug folder) then click “Open”<o:p>

4.      Now you can use AudioButtons just as you use standard buttons from VS .NET. In Properties window, you can find new properties “Audio Button”: ButtonType (ToStart, Rewind, Play, Pause, Stop, Forward, ToEnd), IconLocation and IconSize. They are self-explaining.<o:p>

Further development

There are several properties could be added to the audio buttons, such as colors, gradient changing modes etc.  You can easily add them by following the example of the code (property part). Hope these buttons are of some useful for you either in using them or in writing your own controls.<o:p>

Thanks

Great thanks to Georgi Atanasov, whose article “Owner-draw button” were firstly studied before I started to write my own controls. Great thanks also goes to Carlos H. Perez and his UtilityLibrary.<o:p>

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMute and Click event Pin
Saied Javadi10-Jul-06 5:30
Saied Javadi10-Jul-06 5:30 
QuestionHow to play audio files? Pin
crystalice543296113-Aug-03 5:31
crystalice543296113-Aug-03 5:31 
AnswerRe: How to play audio files? Pin
above13-Aug-03 6:03
above13-Aug-03 6:03 
AnswerRe: How to play audio files? Pin
Ryan_Roberts13-Aug-03 6:04
Ryan_Roberts13-Aug-03 6:04 
AnswerRe: How to play audio files? Pin
dallyanzi13-Aug-03 6:53
dallyanzi13-Aug-03 6:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.