⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 大量优秀的vb编程
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{3B00B10A-6EF0-11D1-A6AA-0020AFE4DE54}#1.0#0"; "MP3PLAY.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   " MP3播放器"
   ClientHeight    =   3732
   ClientLeft      =   120
   ClientTop       =   636
   ClientWidth     =   4476
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3732
   ScaleWidth      =   4476
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.Frame Frame1 
      Caption         =   "操作"
      Height          =   852
      Left            =   240
      TabIndex        =   9
      Top             =   120
      Width           =   3852
      Begin VB.CommandButton Command4 
         Caption         =   "关  闭"
         Height          =   450
         Left            =   3000
         TabIndex        =   15
         Top             =   240
         Width           =   600
      End
      Begin VB.CommandButton Command1 
         Caption         =   "停  止"
         Height          =   450
         Left            =   2040
         TabIndex        =   14
         Top             =   240
         Width           =   600
      End
      Begin VB.CommandButton Command3 
         Caption         =   "暂  停"
         Height          =   450
         Left            =   1200
         TabIndex        =   11
         Top             =   240
         Width           =   600
      End
      Begin VB.CommandButton Command2 
         Caption         =   "播  放"
         Height          =   450
         Left            =   240
         TabIndex        =   10
         Top             =   240
         Width           =   600
      End
   End
   Begin VB.PictureBox Picture1 
      Height          =   1212
      Left            =   360
      Picture         =   "Form1.frx":0000
      ScaleHeight     =   1164
      ScaleWidth      =   3684
      TabIndex        =   3
      Top             =   1320
      Width           =   3732
      Begin VB.Label Label8 
         Alignment       =   2  'Center
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Label5"
         ForeColor       =   &H000000FF&
         Height          =   180
         Left            =   1920
         TabIndex        =   13
         Top             =   840
         Width           =   540
      End
      Begin VB.Label Label7 
         Alignment       =   2  'Center
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Label5"
         ForeColor       =   &H000000FF&
         Height          =   180
         Left            =   960
         TabIndex        =   12
         Top             =   840
         Width           =   540
      End
      Begin VB.Label Label6 
         Alignment       =   2  'Center
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Label6"
         ForeColor       =   &H000000FF&
         Height          =   180
         Left            =   2640
         TabIndex        =   8
         Top             =   480
         Width           =   540
      End
      Begin VB.Label Label5 
         Alignment       =   2  'Center
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Label5"
         ForeColor       =   &H000000FF&
         Height          =   180
         Left            =   960
         TabIndex        =   7
         Top             =   480
         Width           =   540
      End
      Begin VB.Label Label4 
         Alignment       =   2  'Center
         BackColor       =   &H00C0E0FF&
         BackStyle       =   0  'Transparent
         Caption         =   "MP3播放器"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.8
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   1560
         TabIndex        =   6
         Top             =   120
         Width           =   1215
      End
      Begin VB.Label Label3 
         Alignment       =   2  'Center
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Label3"
         ForeColor       =   &H000000FF&
         Height          =   180
         Left            =   1920
         TabIndex        =   5
         Top             =   480
         Width           =   540
      End
      Begin VB.Label Label2 
         Alignment       =   2  'Center
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Label2"
         ForeColor       =   &H000000FF&
         Height          =   180
         Left            =   240
         TabIndex        =   4
         Top             =   480
         Width           =   540
      End
   End
   Begin MSComctlLib.Slider Slider1 
      Height          =   492
      Left            =   1560
      TabIndex        =   2
      Top             =   3120
      Width           =   2532
      _ExtentX        =   4466
      _ExtentY        =   868
      _Version        =   393216
      BorderStyle     =   1
      Max             =   50
      TickStyle       =   3
   End
   Begin MPEGPLAYLib.Mp3Play Mp3Play1 
      Height          =   612
      Left            =   480
      TabIndex        =   0
      Top             =   2760
      Visible         =   0   'False
      Width           =   612
      _Version        =   65536
      _ExtentX        =   1080
      _ExtentY        =   1080
      _StockProps     =   0
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   0
      Top             =   3240
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "音量:"
      Height          =   180
      Left            =   1680
      TabIndex        =   1
      Top             =   2760
      Width           =   456
   End
   Begin VB.Menu menuFile 
      Caption         =   "文件"
      Begin VB.Menu menuOpen 
         Caption         =   "打开MP3文件"
      End
      Begin VB.Menu menuPlay 
         Caption         =   "播放文件"
      End
      Begin VB.Menu menuExit 
         Caption         =   "退出"
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim lv As Long, rv As Long


Private Sub Command1_Click()
    Mp3Play1.Stop
    
End Sub

Private Sub Command2_Click()
  Mp3Play1.Play
End Sub

Private Sub Command3_Click()
  Mp3Play1.Pause

End Sub

Private Sub Command4_Click()
    Mp3Play1.Close
End Sub

Private Sub Form_Load()
erra = Mp3Play1.Authorize("ufo2000", "1208686909 ")
CommonDialog1.DialogTitle = "打开文件"
CommonDialog1.Filter = "MP3文件(*.MP3)|*.mp3"
Label2.Caption = "歌曲名称"
Label3.Caption = "时间"
Label5.Caption = ""
Label6.Caption = ""
Label7.Caption = "kbps"
Label8.Caption = "khz"
Slider1.Value = 25

End Sub

Private Sub menuExit_Click()
    Unload Me
End Sub

Private Sub menuOpen_Click()
Dim totaltimes As Long

Dim mp3file As String, it As Integer
Dim i As Integer
Mp3Play1.Close
CommonDialog1.ShowOpen
  it = Len(CommonDialog1.FileName)
For i = 1 To it
 If Mid(CommonDialog1.FileName, it - i + 1, 1) = "\" Then
    mp3file = Mid(CommonDialog1.FileName, it - i + 2, i - 5)
    Exit For
  End If
  DoEvents
Next i
  Err = Mp3Play1.Open(CommonDialog1.FileName, "")
  totaltimes = Mp3Play1.TotalTime
  Label6.Caption = Str$(totaltimes \ 60000) & "分 " & Str$((totaltimes Mod 60000) / 1000) & "秒"
  Label5.Caption = mp3file
  Label7.Caption = Str$(Mp3Play1.BitRate / 1000) & "kbps"
  Label8.Caption = Str$(Mp3Play1.SampleFrequency / 1000) & "khz"
  lv = Mp3Play1.GetVolumeLeft
  rv = Mp3Play1.GetVolumeRight
End Sub

Private Sub menuPlay_Click()
      i = Mp3Play1.SetVolume(lv / 2, rv / 2)
       Mp3Play1.Play

End Sub

Private Sub Slider1_Change()
 i = Mp3Play1.SetVolume(lv * Slider1.Value / 50, rv * Slider1.Value / 50)
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -