0

I am wondering, how and if it's possible to play a simple sound, when the user moves over a button (button1) for example. I can imagine something like this:

if(button1.Touched) {// play sound }
Marco Bader
  • 29
  • 1
  • 5
  • 3
    You must really hate your users. – Servy Apr 01 '15 at 20:33
  • possible duplicate of [How to play a sound in C#, .NET](http://stackoverflow.com/questions/3502311/how-to-play-a-sound-in-c-net) – balzafin Apr 01 '15 at 20:38
  • It isn't a duplicate. I am asking about the moving over, not clicking. – Marco Bader Apr 01 '15 at 20:42
  • @MarcoBader And when you looked at the documentation for `Button` and looked for an event that would be triggered when the mouse was moved over the button you found... – Servy Apr 01 '15 at 20:44
  • Look for the MouseHover event https://msdn.microsoft.com/en-us/library/system.windows.forms.control.mousehover%28v=vs.110%29.aspx – Sybren Apr 01 '15 at 21:16

1 Answers1

0

Use this:

System.Media.SoundPlayer mediaPlayer = new System.Media.SoundPlayer(@"c:\Sound.wav");

public void button1_MouseHover(object sender, EventArgs e)
{
   mediaPlayer.Play();
}
eYe
  • 1,695
  • 2
  • 29
  • 54