Form1の全コード
using System;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
System.Media.SoundPlayer startSoundPlayer = new System.Media.SoundPlayer(@"C:\Windows\Media\chord.wav");
System.Media.SoundPlayer finishSoundPlayer = new System.Media.SoundPlayer(@"C:\Windows\Media\tada.wav");
public Form1()
{
InitializeComponent();
MoveToStart();
}
private void finishLabel_MouseEnter(object sender, EventArgs e)
{
finishSoundPlayer.Play();
MessageBox.Show("Congratulations!");
Close();
}
private void MoveToStart()
{
startSoundPlayer.Play();
Point startingPoint = Panel1.Location;
startingPoint.Offset(10, 10);
Cursor.Position = PointToScreen(startingPoint);
}
private void wall_MouseEnter(object sender, EventArgs e)
{
MoveToStart();
}
}
}