Dim c1, l1
Private Sub ListBox1_Change()
c1 = 1
l1 = ListBox1.Value
time1 = Timer()
If Timer() < time1 + 1 Then
If c1 = 1 Then
c1 = 0
End If
End If
End Sub
Private Sub ListBox1_Click()
'这个会找不到listbox1.value ?是因为没执行,debug.print 都不执行?
End Sub
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim r1 As Range
Set r1 = Worksheets("中文歌").Range(Cells(1, 1), Cells(1, Worksheets("中文歌").Cells(1, 9999).End(xlToLeft).Column)).Find(l1)
Image1.Picture = LoadPicture(Worksheets("中文歌").Cells(2, r1.Column))
Me.Picture = LoadPicture(Worksheets("中文歌").Cells(2, r1.Column))
WindowsMediaPlayer1.URL = Worksheets("中文歌").Cells(3, r1.Column)
WindowsMediaPlayer1.Controls.Play
k = 4
m = " " & Worksheets("中文歌").Cells(1, r1.Column).Value & " "
Label1.Caption = m
Do While c1 = 0
time1 = Timer()
t = Worksheets("中文歌").Cells(k, 1 + r1.Column)
Label2.Caption = Worksheets("中文歌").Cells(k, r1.Column)
Do
DoEvents
'平行的话,这个快速循环会被堵住?所以只能套在里面
time0 = Timer()
Do
DoEvents
Loop While Timer < time0 + 0.1
m = Right(m, Len(m) - 1) & Left(m, 1)
Label1.Caption = m
Loop While Timer() < time1 + t
k = k + 1
Loop
End Sub
Private Sub ListBox1_Enter()
'listbox1.value 没改变时一般为空,会查到0
End Sub
Private Sub UserForm_Initialize()
'初始化listbox1
For i = 2 To Worksheets("中文歌").Cells(1, 9999).End(xlToLeft).Column
If Not Worksheets("中文歌").Cells(1, i) = "" Then
ListBox1.AddItem Worksheets("中文歌").Cells(1, i)
End If
Next
End Sub
Private Sub CommandButton1_Click()
Load addmusic
addmusic.Show vbModeless
End Sub
Private Sub UserForm_Initialize()
'初始化listbox1
For i = 2 To Worksheets("中文歌").Cells(1, 9999).End(xlToLeft).Column
If Not Worksheets("中文歌").Cells(1, i) = "" Then
ListBox1.AddItem Worksheets("中文歌").Cells(1, i)
End If
Next
End Sub
Private Sub ListBox1_Change()
Dim r1 As Range
Set r1 = Worksheets("中文歌").Range(Cells(1, 1), Cells(1, Worksheets("中文歌").Cells(1, 9999).End(xlToLeft).Column)).Find(ListBox1.Value)
Image1.Picture = LoadPicture(Worksheets("中文歌").Cells(2, r1.Column))
Me.Picture = LoadPicture(Worksheets("中文歌").Cells(2, r1.Column))
WindowsMediaPlayer1.URL = Worksheets("中文歌").Cells(3, r1.Column)
WindowsMediaPlayer1.Controls.Play
k = 4
m = " " & Worksheets("中文歌").Cells(1, r1.Column).Value & " "
Label1.Caption = m
Do
time1 = Timer()
t = Worksheets("中文歌").Cells(k, 1 + r1.Column)
Label2.Caption = Worksheets("中文歌").Cells(k, r1.Column)
Do
DoEvents
'平行的话,这个快速循环会被堵住?所以只能套在里面
time0 = Timer()
Do
DoEvents
Loop While Timer < time0 + 0.1
m = Right(m, Len(m) - 1) & Left(m, 1)
Label1.Caption = m
Loop While Timer() < time1 + t
k = k + 1
Loop While 1 '想知道停止状态,WindowsMediaPlayer1.Controls = False
End Sub
Private Sub CommandButton1_Click()
Load addmusic
addmusic.Show vbModeless
End Sub