Vb.net 还有什么会导致AxWindowsMediaPlayer播放?

Vb.net 还有什么会导致AxWindowsMediaPlayer播放?,vb.net,timer,axwindowsmediaplayer,Vb.net,Timer,Axwindowsmediaplayer,我的程序中有一个按钮,它从DataGridView对象卷、url、延迟等中获取一组信息,并使用这些信息播放文件。我试着让延迟工作,在播放前等待x秒,我很高兴它会工作,但每当我按下按钮,播放就会立即开始。程序中没有Ctlcontrols.play,除了延迟之后,所以我不知道是什么导致它播放 我在评论中进一步解释了我的问题。对不起,如果我没有很好地解释我的代码。如果你能告诉我还有什么能让我的球员立即首发,那就足够了 'snd_btn_go is the button that is supposed

我的程序中有一个按钮,它从DataGridView对象卷、url、延迟等中获取一组信息,并使用这些信息播放文件。我试着让延迟工作,在播放前等待x秒,我很高兴它会工作,但每当我按下按钮,播放就会立即开始。程序中没有Ctlcontrols.play,除了延迟之后,所以我不知道是什么导致它播放

我在评论中进一步解释了我的问题。对不起,如果我没有很好地解释我的代码。如果你能告诉我还有什么能让我的球员立即首发,那就足够了

'snd_btn_go is the button that is supposed to start it.
'This sub doesn't matter as much for the problem, it will just go to SndCueGO() if both numbers are in the valid range.
Private Sub snd_btn_go_Click(sender As Object, e As EventArgs) Handles snd_btn_go.Click
    Dim cue1 As Integer
    Dim cue2 As Integer
    cue1 = If(Integer.TryParse(snd_txt_cue_1.Text, cue1), Int(snd_txt_cue_1.Text), snd_num1)

    If snd_txt_cue_2.Text <> "" Then
        cue2 = If(Integer.TryParse(snd_txt_cue_2.Text, cue2), Int(snd_txt_cue_2.Text), snd_num2)
    Else
        cue2 = -1
    End If
    If (cue1 <= dgSound.Rows.Count - 1 And cue1 > 0) Then 
        SndCueGO(cue1, cue2)
    End If
End Sub

'This sub pulls all the info from the correct row in the DataGrid and assigns it to a list. It'll check if the start volume and end volume are the same and if they're not, it'll fade to the end volume.
Private Sub SndCueGO(cue1, cue2)

    Dim cues() = {cue1, cue2}
    snd_num1 = cue1

    Dim cuedata1 = snd_ds.Tables(0).Rows(cue1 - 1)
    Dim cuedata2 = snd_ds.Tables(0).Rows(cue1 - 1)

    If cue2 <> -1 Then
        snd_num2 = cue2
        cuedata2 = snd_ds.Tables(0).Rows(cue2 - 1)
    End If

    Dim data() = {cuedata1, cuedata2}

    For i = 0 To 1
        If cues(i) <> -1 Then
            snd_delay(i) = data(i).Item("Delay")
            snd_startvol(i) = safeNum(data(i).Item("Start_Vol."))
            snd_file(i) = data(i).Item("File")
            snd_in(i) = data(i).Item("Fade_In")
            snd_out(i) = data(i).Item("Fade_Out")
            snd_vol(i) = safeNum(data(i).Item("Vol."))
            snd_hold(i) = data(i).Item("Hold")
            snd_af(i) = If(data(i).Item("AF") = "", False, True)
            player_list(i).URL = snd_file(i)

            snd_current(i) = snd_startvol(i)

            If snd_startvol(i) <> snd_vol(i) Then 'snd_startvol(i) and snd_vol(i) were the same in all my tests, so this should not run.
                snd_next(i) = snd_vol(i)

                Dim num_steps_up = snd_in(i) * snd_speed
                Dim num_steps_down = snd_out(i) * snd_speed
                Dim diff = snd_vol(i) - snd_startvol(i)
                Dim small_step As Single
                If diff > 0 Then
                    small_step = diff / num_steps_up
                ElseIf diff < 0 Then
                    small_step = diff / num_steps_down
                End If
                snd_steps(i) = small_step

                timer_snd_fade.Tag = 0
                timer_snd_fade.Enabled = True

            End If

            timer_snd_master.Tag = 0 'resets the tag to 0
            timer_snd_master.Enabled = True 'Starts timer

        End If
    Next

End Sub

Private Sub timer_snd_master_Tick(sender As Object, e As EventArgs) Handles timer_snd_master.Tick
    If sender.Tag = snd_delay(0) Then
        Player1.Ctlcontrols.play() 'This is the only play command in the program
        Debug.Print("tag " & sender.Tag) 'These print after the delay
        Debug.Print("delay " & snd_delay(0))
    End If

    sender.Tag += 1
End Sub
检查:

AxWindowsMediaPlayer player1 = ...; // get the player from UI
IWMPSettings sett = player.settings;

sett.autoStart == ??

它可能设置为true,因为它是默认值。只需将其设置为false,直到调用Ctlcontrols.play,播放器才会播放