הגדרתי שני נגנים והפעלתי אותם אחד אחרי השני , ברגע שהשני התחיל לפעול הראשון הופסק מבלי שהפסקתי אותו
SoundPlayer player1 = new SoundPlayer(); //הגדרת הנגן1 SoundPlayer player2 = new SoundPlayer(); //הגדרת נגן2 //---------------------------- private void pictureBox4_Click(object sender, EventArgs e) { if (F1 == 0) { player2.SoundLocation = "sounds//hold.wav"; player2.Play(); pictureBox4.Image = Image.FromFile("Hold2.png"); F1 = 1; CheckRounds(F1, F2, F3); } else if (F1 == 1) { pictureBox4.Image = Image.FromFile("Hold.png"); F1 = 1; CheckRounds(F1, F2, F3); } }
|
בקוד מצוין הפעלת הנגן השני בזמן שהראשון כבר פעיל