发布网友 发布时间:2024-10-24 00:15
共2个回答
热心网友 时间:12小时前
Private Sub Form_Load()
Dim rndList As Integer
Dim strName As String
If List1.ListCount > 0 Then
rndList = RandId(List1.ListCount) '随机读取ListBox 一条记录索引号
strName = List1.List(rndList) '随机返回 ListBox 列表中的歌曲名
'然后用WindowsMediaPlayer1 播放 strName 就可以了
End If
End Sub
Private Function RandId(ByVal MyListIndex As Integer) As Integer
Randomize
RandId = Int(Rnd * MyListIndex)
End Function
热心网友 时间:12小时前
Private Sub Command1_Click()
WindowsMediaPlayer1.stretchToFit = True
WindowsMediaPlayer1.URL = List1.ListIndex
End Sub