📄 form1.frm
字号:
VERSION 5.00
Object = "{6BF52A50-394A-11D3-B153-00C04F79FAA6}#1.0#0"; "wmp.dll"
Begin VB.Form Form1
Caption = "音乐播放"
ClientHeight = 5970
ClientLeft = 60
ClientTop = 450
ClientWidth = 5895
LinkTopic = "Form1"
ScaleHeight = 5970
ScaleWidth = 5895
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command8
Caption = "首页"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 0
Picture = "Form1.frx":0000
Style = 1 'Graphical
TabIndex = 12
Top = 0
Width = 1575
End
Begin VB.CommandButton Command7
Caption = "停 止"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3720
Picture = "Form1.frx":072C
Style = 1 'Graphical
TabIndex = 11
Top = 0
Width = 1095
End
Begin VB.CommandButton Command6
Caption = "列表"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4800
Picture = "Form1.frx":0E58
Style = 1 'Graphical
TabIndex = 8
Top = 0
Width = 1095
End
Begin VB.Timer Timer1
Left = 7680
Top = 1920
End
Begin VB.ListBox List1
Height = 240
Left = 7440
TabIndex = 6
Top = 3120
Visible = 0 'False
Width = 615
End
Begin VB.CommandButton Command5
Caption = "退出"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4680
Picture = "Form1.frx":1584
Style = 1 'Graphical
TabIndex = 5
Top = 5400
Width = 1095
End
Begin VB.CommandButton Command4
Caption = "上一首"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
Picture = "Form1.frx":1CB0
Style = 1 'Graphical
TabIndex = 4
Top = 5400
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "下一首"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2040
Picture = "Form1.frx":23DC
Style = 1 'Graphical
TabIndex = 3
Top = 5400
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "暂停"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2640
Picture = "Form1.frx":2B08
Style = 1 'Graphical
TabIndex = 2
Top = 0
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "播 放"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
Picture = "Form1.frx":3234
Style = 1 'Graphical
TabIndex = 1
Top = 0
Width = 1095
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 10
Top = 2520
Width = 3255
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "正在播放:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 9
Top = 2160
Width = 1455
End
Begin VB.Label Label1
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 300
Left = 0
TabIndex = 7
Top = 0
Width = 4425
End
Begin WMPLibCtl.WindowsMediaPlayer WindowsMediaPlayer1
Height = 4635
Left = 0
TabIndex = 0
Top = 360
Width = 5880
URL = ""
rate = 1
balance = 0
currentPosition = 0
defaultFrame = ""
playCount = 1
autoStart = -1 'True
currentMarker = 0
invokeURLs = -1 'True
baseURL = ""
volume = 50
mute = 0 'False
uiMode = "mini"
stretchToFit = 0 'False
windowlessVideo = 0 'False
enabled = -1 'True
enableContextMenu= -1 'True
fullScreen = 0 'False
SAMIStyle = ""
SAMILang = ""
SAMIFilename = ""
captioningID = ""
enableErrorDialogs= 0 'False
_cx = 10372
_cy = 8176
End
Begin VB.Image Image1
Height = 5520
Left = 0
Picture = "Form1.frx":3960
Top = 480
Width = 7275
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Form2.List1.ListIndex = -1 Then
If Form2.List1.List(0) = "" Then
MsgBox "请选择歌曲!"
Else
Form2.List1.ListIndex = Form2.List1.ListIndex + 1
Call List1_DBLClick
Command3.Enabled = True
Command1.Enabled = True
Command4.Enabled = True
Command7.Enabled = True
Command2.Enabled = True
End If
Else
Call List1_DBLClick
Command3.Enabled = True
Command1.Enabled = True
Command4.Enabled = True
Command7.Enabled = True
Command2.Enabled = True
End If
End Sub
Private Sub Command2_Click()
If WindowsMediaPlayer1.playState = 2 Then
WindowsMediaPlayer1.Controls.play
Command3.Enabled = True
Command1.Enabled = True
Command4.Enabled = True
Command7.Enabled = True
Command2.Enabled = True
Else
WindowsMediaPlayer1.Controls.pause
Command3.Enabled = False
Command1.Enabled = True
Command4.Enabled = False
Command7.Enabled = False
Command2.Enabled = True
End If
End Sub
Private Sub Command3_Click()
If Form2.List1.ListIndex = Form2.List1.ListCount - 1 Then
Form2.List1.ListIndex = 0
Call List1_DBLClick
Else
Form2.List1.ListIndex = Form2.List1.ListIndex + 1
Call List1_DBLClick
End If
End Sub
Private Sub Command4_Click()
If Form2.List1.ListIndex = Form2.List1.ListIndex + 1 Then
Else
Form2.List1.ListIndex = Form2.List1.ListIndex - 1
If Form2.List1.ListIndex = 0 Then
MsgBox "这是第一首歌曲!"
Call List1_DBLClick
End If
End If
If Form2.List1.ListIndex = -1 Then
MsgBox "无法再选择上一首!"
Command4.Enabled = False
End If
End Sub
Private Sub Command5_Click()
End
End Sub
Private Sub Command6_Click()
Form2.Show
Form1.Visible = False
End Sub
Private Sub Command7_Click()
WindowsMediaPlayer1.Controls.stop
Command3.Enabled = False
Command1.Enabled = True
Command4.Enabled = False
Command2.Enabled = False
End Sub
Private Sub Command8_Click()
Form3.Show
Form1.Visible = False
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = True
Command3.Enabled = False
Command1.Enabled = True
Command4.Enabled = False
Command7.Enabled = False
Command2.Enabled = False
End Sub
Private Sub List1_DBLClick()
Me.Caption = "我的播放器 当前播放" & pa & Form2.List1.Text
WindowsMediaPlayer1.URL = pa & Form2.List1.Text
Label3.Caption = Form2.List1.Text
End Sub
Private Sub Timer1_Timer()
Dim timey, timem, timed, timeh, timemi, i As String
Dim tim As Integer
timey = CStr(Year(Now))
timem = CStr(Month(Now))
timed = CStr(Day(Now))
timeh = CStr(Hour(Now))
timemi = CStr(Minute(Now))
If Val(timeh) > 12 Then
i = "PM"
tim = Val(timeh) - 12
Else
i = "AM"
End If
Label1.Caption = "当前时间:" & timey & "年" & timem & "月" & timed & "日" & i & (CStr(tim)) & "时" & timemi & "分"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -