level 11
幽狼梦天下
楼主
'楼主自创的坑爹显示歌词方法,不知到网上是否已有(反正我没百度)
'只支持lrc歌词格式
'歌词文件与音乐文件路径必须一致'不喜勿喷
'需添加控件:windowsmediaplayer1,label1,label2,timer1
Dim file() As String, n As String
Sub lrc()
Dim 分割1() As String, 分割2() As String, t As String
If Dir(n) <> "" Then
Open n For Input As #1
Do While Not EOF(1)
Line Input #1, a
分割1 = Split(a, "]")'lrc歌词文件格式为 “[00:00.00]xxxxxx”,所以,我们先以“]”为界分割成 “[00:00.00” 和 “xxxxxx”
分割2 = Split(分割1(LBound(分割1)), ".") '再把 “[00:00.00”以“.”为界,割成 “[00:00” 和 “00”
t = Right(分割2(LBound(分割2)), Len(分割2(LBound(分割2))) - 1)'最后取出"00:00"
If Label2.Caption = t Then Label1.Caption = 分割1(UBound(分割1))'播放进度=歌词前面的时间时,标签=歌词
Loop Close #1
End If
End Sub
Private Sub Form_Load()
Me.Caption = "将歌曲文件拖拽到label1上开始播放歌曲"
Label1.OLEDropMode = 1
End Sub
Private Sub Label1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Data.GetFormat(vbCFFiles) = True Then
Me.Caption = Data.Files(1)
file = Split(Me.Caption, ".")
n = file(LBound(file)) & ".lrc"
WindowsMediaPlayer1.URL = Me.Caption
Timer1.Interval = 1000
Timer1_Timer
End If
End Sub
Private Sub Timer1_Timer()
Label2.Caption = WindowsMediaPlayer1.Controls.currentPositionString
lrc
End Sub
2013年02月21日 11点02分
1
'只支持lrc歌词格式
'歌词文件与音乐文件路径必须一致'不喜勿喷
'需添加控件:windowsmediaplayer1,label1,label2,timer1
Dim file() As String, n As String
Sub lrc()
Dim 分割1() As String, 分割2() As String, t As String
If Dir(n) <> "" Then
Open n For Input As #1
Do While Not EOF(1)
Line Input #1, a
分割1 = Split(a, "]")'lrc歌词文件格式为 “[00:00.00]xxxxxx”,所以,我们先以“]”为界分割成 “[00:00.00” 和 “xxxxxx”
分割2 = Split(分割1(LBound(分割1)), ".") '再把 “[00:00.00”以“.”为界,割成 “[00:00” 和 “00”
t = Right(分割2(LBound(分割2)), Len(分割2(LBound(分割2))) - 1)'最后取出"00:00"
If Label2.Caption = t Then Label1.Caption = 分割1(UBound(分割1))'播放进度=歌词前面的时间时,标签=歌词
Loop Close #1
End If
End Sub
Private Sub Form_Load()
Me.Caption = "将歌曲文件拖拽到label1上开始播放歌曲"
Label1.OLEDropMode = 1
End Sub
Private Sub Label1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Data.GetFormat(vbCFFiles) = True Then
Me.Caption = Data.Files(1)
file = Split(Me.Caption, ".")
n = file(LBound(file)) & ".lrc"
WindowsMediaPlayer1.URL = Me.Caption
Timer1.Interval = 1000
Timer1_Timer
End If
End Sub
Private Sub Timer1_Timer()
Label2.Caption = WindowsMediaPlayer1.Controls.currentPositionString
lrc
End Sub
