📄 frmmediap.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{22D6F304-B0F6-11D0-94AB-0080C74C7E95}#1.0#0"; "MSDXM.OCX"
Begin VB.Form frmMediaP
Caption = "多媒体播放器"
ClientHeight = 3315
ClientLeft = 165
ClientTop = 735
ClientWidth = 4275
Icon = "frmMediaP.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3315
ScaleWidth = 4275
StartUpPosition = 3 'Windows Default
Begin MSComDlg.CommonDialog cmdlgFile
Left = 2280
Top = 1440
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MediaPlayerCtl.MediaPlayer MediaP
Height = 3255
Left = 0
TabIndex = 0
Top = 0
Width = 4215
AudioStream = -1
AutoSize = 0 'False
AutoStart = -1 'True
AnimationAtStart= -1 'True
AllowScan = -1 'True
AllowChangeDisplaySize= -1 'True
AutoRewind = 0 'False
Balance = 0
BaseURL = ""
BufferingTime = 5
CaptioningID = ""
ClickToPlay = -1 'True
CursorType = 0
CurrentPosition = -1
CurrentMarker = 0
DefaultFrame = ""
DisplayBackColor= 0
DisplayForeColor= 16777215
DisplayMode = 0
DisplaySize = 4
Enabled = -1 'True
EnableContextMenu= -1 'True
EnablePositionControls= -1 'True
EnableFullScreenControls= 0 'False
EnableTracker = -1 'True
Filename = ""
InvokeURLs = -1 'True
Language = -1
Mute = 0 'False
PlayCount = 1
PreviewMode = 0 'False
Rate = 1
SAMILang = ""
SAMIStyle = ""
SAMIFileName = ""
SelectionStart = -1
SelectionEnd = -1
SendOpenStateChangeEvents= -1 'True
SendWarningEvents= -1 'True
SendErrorEvents = -1 'True
SendKeyboardEvents= 0 'False
SendMouseClickEvents= 0 'False
SendMouseMoveEvents= 0 'False
SendPlayStateChangeEvents= -1 'True
ShowCaptioning = 0 'False
ShowControls = -1 'True
ShowAudioControls= -1 'True
ShowDisplay = 0 'False
ShowGotoBar = 0 'False
ShowPositionControls= -1 'True
ShowStatusBar = 0 'False
ShowTracker = -1 'True
TransparentAtStart= 0 'False
VideoBorderWidth= 0
VideoBorderColor= 0
VideoBorder3D = 0 'False
Volume = -180
WindowlessVideo = 0 'False
End
Begin VB.Menu mnuFile
Caption = "文件(&F)"
Begin VB.Menu mnuFileOpen
Caption = "打开(&O)"
End
Begin VB.Menu mnuFileClose
Caption = "关闭(&C)"
End
Begin VB.Menu mnuFileLine
Caption = "-"
Visible = 0 'False
End
Begin VB.Menu mnuFileName0
Caption = "文件名"
Visible = 0 'False
End
Begin VB.Menu mnuFileName1
Caption = "文件名"
Visible = 0 'False
End
Begin VB.Menu mnuFileLine1
Caption = "-"
End
Begin VB.Menu mnuFileExit
Caption = "退出(&X)"
End
End
Begin VB.Menu mnuView
Caption = "查看(&V)"
Begin VB.Menu mnuViewMin
Caption = "最小(&M)"
End
Begin VB.Menu mnuViewC
Caption = "简洁(&C)"
End
Begin VB.Menu mnuViewS
Caption = "标准(&S)"
End
Begin VB.Menu mnuViewBar
Caption = "工具条(&B)…"
Begin VB.Menu mnuViewBarControls
Caption = "播放控制"
End
Begin VB.Menu mnuViewBarAudio
Caption = "声音控制"
End
Begin VB.Menu mnuViewBarCaptioning
Caption = "字幕"
End
Begin VB.Menu mnuViewBarGoto
Caption = "Goto栏"
End
Begin VB.Menu mnuViewBarDisplay
Caption = "信息显示栏"
End
Begin VB.Menu mnuViewBarPosition
Caption = "显示位置条"
End
Begin VB.Menu mnuViewBarTracker
Caption = "轨道栏"
End
Begin VB.Menu mnuViewBarStatus
Caption = "状态栏"
End
End
Begin VB.Menu mnuViewLine0
Caption = "-"
End
Begin VB.Menu mnuViewFull
Caption = "全屏显示(&F)"
End
Begin VB.Menu mnuViewsf
Caption = "缩放…"
Begin VB.Menu mnuViewsfSame
Caption = "原始大小"
End
Begin VB.Menu mnuViewsfHalf
Caption = "50%"
End
Begin VB.Menu mnuViewsfTwo
Caption = "200%"
End
Begin VB.Menu mnuViewsfSix
Caption = "屏幕的1/ 16"
End
Begin VB.Menu mnuViewsfFour
Caption = "屏幕的1/ 4"
End
Begin VB.Menu mnuViewsfTwoOne
Caption = "屏幕的1/ 2"
End
End
Begin VB.Menu mnuViewLine1
Caption = "-"
End
Begin VB.Menu mnuViewStat
Caption = "统计信息(&T)…"
End
Begin VB.Menu mnuViewLine2
Caption = "-"
End
Begin VB.Menu mnuViewPre
Caption = "选项(&O)…"
End
End
Begin VB.Menu mnuPlay
Caption = "播放(&P)"
Begin VB.Menu mnuPlayPP
Caption = "播放/暂停"
Shortcut = ^P
End
Begin VB.Menu mnuPlayStop
Caption = "停止"
Shortcut = ^S
End
Begin VB.Menu mnuPlayLine0
Caption = "-"
End
Begin VB.Menu mnuPlayhj
Caption = "向后跳进"
Shortcut = ^K
End
Begin VB.Menu mnuPlayqj
Caption = "向前跳进"
Shortcut = ^J
End
End
Begin VB.Menu mnuCtrl
Caption = "控制(&K)"
Begin VB.Menu mnuCtrlMute
Caption = "静音"
Shortcut = ^M
End
Begin VB.Menu mnuCtrlBig
Caption = "声量增加"
Shortcut = ^{INSERT}
End
Begin VB.Menu mnuCtrlSmall
Caption = "声量减少"
Shortcut = +{INSERT}
End
Begin VB.Menu mnuCtrlLine1
Caption = "-"
End
Begin VB.Menu mnuCtrlLeft
Caption = "左声道"
Shortcut = ^L
End
Begin VB.Menu mnuCtrlRight
Caption = "右声道"
Shortcut = ^R
End
Begin VB.Menu mnuCtrlStereo
Caption = "立体声"
Shortcut = ^T
End
Begin VB.Menu mnuCtrlLine2
Caption = "-"
End
Begin VB.Menu mnuCtrlFrontColor
Caption = "前景色…"
End
Begin VB.Menu mnuCtrlBackColor
Caption = "背景色…"
End
Begin VB.Menu mnuCtrlLine3
Caption = "-"
End
Begin VB.Menu mnuCtrl3D
Caption = "3D边界"
End
Begin VB.Menu mnuCtrlColor
Caption = "边界颜色…"
End
Begin VB.Menu mnuCtrlWidth
Caption = "边界宽度…"
Begin VB.Menu mnuCtrlWidthBig
Caption = "增加"
End
Begin VB.Menu mnuCtrlWidthSmall
Caption = "减少"
End
End
End
Begin VB.Menu mnuHelp
Caption = "帮助(&H)"
Begin VB.Menu mnuHelpMP
Caption = "Media Player帮助…"
End
Begin VB.Menu mnuHelpAboutMP
Caption = "关于MediaPlayer…"
End
Begin VB.Menu mnuHelpLine
Caption = "-"
End
Begin VB.Menu mnuHelpAbout
Caption = "关于此程序"
End
End
End
Attribute VB_Name = "frmMediaP"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private arrFileName() As String
Private m_intFileCount As Integer
Private m_sngScreenHeight As Single
Private m_sngScreenWidth As Single
Dim m_strPreFileName As String
Private Sub Form_Load()
'定义文件数组
m_intFileCount = 0
ReDim arrFileName(0) As String
arrFileName(0) = ""
'从注册表中读取最近打开的文件名
mnuFileName0.Caption = GetSetting("MPApp", "FileName", "File1")
mnuFileName1.Caption = GetSetting("MPApp", "FileName", "File2")
'显示在文件菜单栏上
If mnuFileName1.Caption <> "文件名" And mnuFileName1.Caption <> "" Then
m_intFileCount = m_intFileCount + 1
ReDim Preserve arrFileName(m_intFileCount) As String
arrFileName(m_intFileCount) = mnuFileName1.Caption
mnuFileName1.Visible = True
mnuFileLine.Visible = True
End If
If mnuFileName0.Caption <> "文件名" And mnuFileName0.Caption <> "" Then
m_intFileCount = m_intFileCount + 1
ReDim Preserve arrFileName(m_intFileCount) As String
arrFileName(m_intFileCount) = mnuFileName0.Caption
mnuFileName0.Visible = True
mnuFileLine.Visible = True
End If
m_sngScreenHeight = frmMediaP.ScaleHeight
m_sngScreenWidth = frmMediaP.ScaleWidth
End Sub
Private Sub Form_Resize()
'使Media Player大小和窗口大小相匹配
MediaP.Height = frmMediaP.ScaleHeight
MediaP.Width = frmMediaP.ScaleWidth
m_sngScreenHeight = frmMediaP.ScaleHeight
m_sngScreenWidth = frmMediaP.ScaleWidth
End Sub
Private Sub mnuCtrl3D_Click()
'设置3D效果的边界
mnuCtrl3D.Checked = Not mnuCtrl3D.Checked
If mnuCtrl3D.Checked Then
MediaP.VideoBorder3D = True
Else
MediaP.VideoBorder3D = False
End If
End Sub
Private Sub mnuCtrlBackColor_Click()
'弹出颜色对话框,选择背景颜色
cmdlgFile.ShowColor
MediaP.DisplayBackColor = cmdlgFile.Color
End Sub
Private Sub mnuCtrlBig_Click()
'增大音量
If MediaP.Volume + 300 <= 0 Then
MediaP.Volume = MediaP.Volume + 300
End If
End Sub
Private Sub mnuCtrlColor_Click()
'弹出颜色对话框,选择边界颜色
cmdlgFile.ShowColor
MediaP.VideoBorderColor = cmdlgFile.Color
End Sub
Private Sub mnuCtrlFrontColor_Click()
'弹出颜色对话框,选择前景色
cmdlgFile.ShowColor
MediaP.DisplayForeColor = cmdlgFile.Color
End Sub
Private Sub mnuCtrlLeft_Click()
'设置左声道
mnuCtrlLeft.Checked = Not mnuCtrlLeft.Checked
If mnuCtrlLeft.Checked Then
MediaP.Balance = -10000
mnuCtrlRight.Checked = False
mnuCtrlStereo.Checked = False
Else
MediaP.Balance = 0
mnuCtrlLeft.Checked = False
mnuCtrlRight.Checked = False
End If
End Sub
Private Sub mnuCtrlMute_Click()
'设置静音
If MediaP.Mute Then
MediaP.Mute = False
mnuCtrlBig.Enabled = True
mnuCtrlSmall.Enabled = True
Else
MediaP.Mute = True
mnuCtrlBig.Enabled = False
mnuCtrlSmall.Enabled = False
End If
mnuCtrlMute.Checked = MediaP.Mute
End Sub
Private Sub mnuCtrlRight_Click()
'设置右声道
mnuCtrlRight.Checked = Not mnuCtrlRight.Checked
If mnuCtrlRight.Checked Then
MediaP.Balance = -10000
mnuCtrlLeft.Checked = False
mnuCtrlStereo.Checked = False
Else
MediaP.Balance = 0
mnuCtrlLeft.Checked = False
mnuCtrlRight.Checked = False
End If
End Sub
Private Sub mnuCtrlSmall_Click()
'减少音量
If MediaP.Volume - 300 >= -10000 Then
MediaP.Volume = MediaP.Volume - 300
End If
End Sub
Private Sub mnuCtrlStereo_Click()
'设置立体声
mnuCtrlStereo.Checked = True
MediaP.Balance = 0
mnuCtrlLeft.Checked = False
mnuCtrlRight.Checked = False
End Sub
Private Sub mnuCtrlWidthBig_Click()
'增加边界的宽度
If MediaP.VideoBorderWidth + 2 <= 10 Then
MediaP.VideoBorderWidth = MediaP.VideoBorderWidth + 2
End If
End Sub
Private Sub mnuCtrlWidthSmall_Click()
'减少边界的宽度
If MediaP.VideoBorderWidth - 2 >= 0 Then
MediaP.VideoBorderWidth = MediaP.VideoBorderWidth - 2
End If
End Sub
Private Sub mnuFileClose_Click()
'关闭文件
MediaP.Stop
MediaP.FileName = ""
'View菜单不起作用
mnuViewsf.Enabled = False
End Sub
Private Sub mnuFileExit_Click()
'退出程序,把打开的文件名保存到注册表中
SaveSetting "MPApp", "FileName", "File1", mnuFileName0.Caption
SaveSetting "MPApp", "FileName", "File2", mnuFileName1.Caption
'结束程序
End
End Sub
Private Sub mnuFileName0_Click()
m_strPreFileName = arrFileName(m_intFileCount)
FileOpen m_strPreFileName, mnuFileName0.Caption
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -