Inferred sound handling

This commit is contained in:
2022-07-13 22:59:19 +02:00
parent 49a8dec39e
commit 30625845d1
2 changed files with 28 additions and 0 deletions

View File

@ -37,6 +37,7 @@
this.btnAddPlayer = new System.Windows.Forms.Button(); this.btnAddPlayer = new System.Windows.Forms.Button();
this.txtNewName = new System.Windows.Forms.TextBox(); this.txtNewName = new System.Windows.Forms.TextBox();
this.btnAddOk = new System.Windows.Forms.Button(); this.btnAddOk = new System.Windows.Forms.Button();
this.btnSound = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// label1 // label1
@ -122,11 +123,23 @@
this.btnAddOk.Visible = false; this.btnAddOk.Visible = false;
this.btnAddOk.Click += new System.EventHandler(this.btnAddOk_Click); this.btnAddOk.Click += new System.EventHandler(this.btnAddOk_Click);
// //
// btnSound
//
this.btnSound.Location = new System.Drawing.Point(350, 34);
this.btnSound.Name = "btnSound";
this.btnSound.Size = new System.Drawing.Size(75, 23);
this.btnSound.TabIndex = 6;
this.btnSound.Text = "sound";
this.btnSound.UseVisualStyleBackColor = true;
this.btnSound.Visible = false;
this.btnSound.Click += new System.EventHandler(this.btnSound_Click);
//
// frmStart // frmStart
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450); this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.btnSound);
this.Controls.Add(this.btnAddOk); this.Controls.Add(this.btnAddOk);
this.Controls.Add(this.txtNewName); this.Controls.Add(this.txtNewName);
this.Controls.Add(this.btnAddPlayer); this.Controls.Add(this.btnAddPlayer);
@ -152,5 +165,6 @@
private Button btnAddPlayer; private Button btnAddPlayer;
private TextBox txtNewName; private TextBox txtNewName;
private Button btnAddOk; private Button btnAddOk;
private Button btnSound;
} }
} }

View File

@ -1,3 +1,5 @@
using System.Media;
namespace WinGreed namespace WinGreed
{ {
public partial class frmStart : Form public partial class frmStart : Form
@ -64,5 +66,17 @@ namespace WinGreed
btnAddOk.Visible = false; btnAddOk.Visible = false;
} }
} }
private void PlaySomething()
{
var soundPlayer = new SoundPlayer();
soundPlayer.SoundLocation = @"C:\Users\tommy\Downloads\smartsound_HUMAN_CROWD_Applause_Short.wav";
soundPlayer.Play();
}
private void btnSound_Click(object sender, EventArgs e)
{
PlaySomething();
}
} }
} }