23-05-13, 08:55 PM
السلام عليكم ورحمة الله وبركاته
أضف للفورم أداة الميديا بلاير وأداة تايمر بمؤقت 1000 مللي ثانية
قد يوجد كود أحسن من هذا
****
***
**
*
أضف للفورم أداة الميديا بلاير وأداة تايمر بمؤقت 1000 مللي ثانية
كود :
Private Sub OpenMedia()
Dim ofd As New OpenFileDialog
ofd.Filter = "MP3 media (*.mp3)|*.mp3"
ofd.Multiselect = True
If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
Me.ListBox1.Items.AddRange(ofd.FileNames)
Play()
End If
End Sub
Private Sub Play()
If Me.ListBox1.Items.Count > 0 Then
If Me.ListBox1.SelectedItems.Count > 0 Then
Me.AxWindowsMediaPlayer1.URL = Me.ListBox1.SelectedItem.ToString
Me.AxWindowsMediaPlayer1.Ctlcontrols.play()
Me.Timer1.Enabled = True
End If
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsStopped Then
If Me.ListBox1.Items.Count > 0 Then
If Not Me.ListBox1.SelectedIndex = Me.ListBox1.Items.Count - 1 Then
Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1
Me.Timer1.Enabled = False
Play()
Else
Me.Timer1.Enabled = False
End If
End If
End If
End Subقد يوجد كود أحسن من هذا
****
***
**
*

