如果播放声音则暂停代码,然后开始然后结束

时间:2019-06-14 16:52:15

标签: vb.net

我希望此代码仅在音乐结束后才开始。完全是这段代码:

            BttStart.Enabled = True
            BttStart.PerformClick()
            BttStart.Enabled = False

我想说的是,当我给出答案时,请留在第一个声音的变体上,即“ \ Gfx \ Final answer.wav,然后执行第二个声音,&” \ Gfx \ Lightdown.wav “)

这就是所有代码:

 Private Sub BttRaspuns_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BttRaspuns.Click
        AnswerA.Visible = True
        AnswerB.Visible = True
        AnswerC.Visible = True
        AnswerD.Visible = True
        If CheckedTxt.Text = ("0") Then
            MsgBox("Unfortunately, you did not select any answer.", vbInformation)
        ElseIf CheckedTxt.Text = ("1") Then
            My.Computer.Audio.Play(System.AppDomain.CurrentDomain.BaseDirectory & "\Gfx\Final answer.wav")
            CheckedTxt.Text = ("0")
            If LBCheckAnswer.Text = LbVar.Text Then
                IntreabaPubliculVisibilitateRC()
                ' Dacă Răspunsul dat este cel ` Corect `
                My.Computer.Audio.Play(System.AppDomain.CurrentDomain.BaseDirectory & "\Gfx\Lightdown.wav")
                MsgBox("Answer is Correct", vbInformation)
                AnswerA.BackColor = Color.Black
                AnswerB.BackColor = Color.Black
                AnswerC.BackColor = Color.Black
                AnswerD.BackColor = Color.Black
                CheckABox.Checked = False
                CheckBBox.Checked = False
                CheckCBox.Checked = False
                CheckDBox.Checked = False
                IncreaseTxt.Text = Val(IncreaseTxt.Text) + ("1")
                BttStart.Enabled = True
                BttStart.PerformClick()
                BttStart.Enabled = False
            Else ' Dacă Răspunsul dat este ` Gresit `

使其几次捕捉,每次正确的答案都是AnswerA.BackColor

   My.Computer.Audio.Play(System.AppDomain.CurrentDomain.BaseDirectory & "\Gfx\Lightdown.wav")
                AnswerA.BackColor = Color.Black
                AnswerA.BackColor = Color.Red
                AnswerA.BackColor = Color.Black
                AnswerA.BackColor = Color.Red

不幸的是,该代码无法正常工作。

0 个答案:

没有答案