executer une action avec condition
bonjour;
j'ai mon formulaire qui a 20 activeX media player(vignette image) + 1 central qui me permet de visionner des videos(les 20 sont pour visionner des images jpg) et 1 bouton play .ce que j'aimerai faire c'est de pouvoir lire la video apres un click sur 1 vignette image et 1 click sur le bouton play(image correspondant a la video)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Private Sub AxWindowsMediaPlayer1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxWindowsMediaPlayer1.Enter
Dim cmd As OleDbCommand = cn.CreateCommand
Dim titre As String = "titre : "
Dim i As Integer
Dim Xwmp As IWMPMedia
cmd.CommandText = "SELECT clip FROM testa WHERE [n°] =1"
Dim LectureLignejpg As OleDbDataReader = cmd.ExecuteReader
While LectureLignejpg.Read()
i = 1
Xwmp = DirectCast(Me.Controls("AxWindowsMediaPlayer" & i), AxWindowsMediaPlayer).newMedia(LectureLignejpg(0))
DirectCast(Me.Controls("AxWindowsMediaPlayer" & i), AxWindowsMediaPlayer).currentPlaylist.insertItem(0, Xwmp)
DirectCast(Me.Controls("AxWindowsMediaPlayer" & i), AxWindowsMediaPlayer).Ctlcontrols.play()
DirectCast(Me.Controls("AxWindowsMediaPlayer" & i), AxWindowsMediaPlayer).Ctlcontrols.pause()
End While
End Sub |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Private Sub Play_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Play.Click
Dim cmd As OleDbCommand = cn.CreateCommand
Dim Xwmp As IWMPMedia
Dim i As Integer
cmd.CommandText = "SELECT clip FROM test WHERE [n°] =" & i
Dim LectureLigne As OleDbDataReader = cmd.ExecuteReader
While LectureLigne.Read()
Xwmp = AxWindowsMediaPlayer3000.newMedia(LectureLigne(0))
AxWindowsMediaPlayer3000.currentPlaylist.insertItem(0, Xwmp)
AxWindowsMediaPlayer3000.Ctlcontrols.play()
AxWindowsMediaPlayer3000.Ctlcontrols.pause()
Me.Label2.Text = titre & "lecture de " & System.IO.Path.GetFileNameWithoutExtension(LectureLigne(0))
End While
LectureLigne.Close()
End Sub |