📄 form1.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 Form1
Caption = "自己的VCD播放器"
ClientHeight = 3444
ClientLeft = 132
ClientTop = 708
ClientWidth = 4980
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3444
ScaleWidth = 4980
StartUpPosition = 3 'Windows Default
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 1000
Left = 120
Top = 480
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 4320
Top = 2280
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H80000004&
Caption = "00:00:00"
ForeColor = &H000000FF&
Height = 180
Left = 4320
TabIndex = 1
Top = 0
Width = 720
End
Begin MediaPlayerCtl.MediaPlayer MediaPlayer1
Height = 3375
Left = 240
TabIndex = 0
Top = 0
Width = 4455
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 = -600
WindowlessVideo = 0 'False
End
Begin VB.Menu file
Caption = "文件"
Begin VB.Menu fopen
Caption = "打开"
End
Begin VB.Menu exit
Caption = "退出"
End
End
Begin VB.Menu view
Caption = "屏幕大小"
Begin VB.Menu nommal
Caption = "正常大小"
End
Begin VB.Menu double
Caption = "双倍大小"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Const DRIVE_CDROM = 5
Dim temp As Integer, hh As Integer, mm As Integer, ss As Integer
Dim MFile As String
Private Sub double_Click()
temp = 2
Form1.Height = 4125 * 2
Form1.Width = 5100 * 2
MediaPlayer1.Width = 4550 * 2 + 480
MediaPlayer1.Height = 3375 * 2 + 850
Label1.Left = (MediaPlayer1.Left + MediaPlayer1.Width - Label1.Width) * 0.8
Label1.Top = MediaPlayer1.Top + MediaPlayer1.Height - Label1.Height - 50
End Sub
Private Sub exit_Click()
End
End Sub
Private Sub fopen_Click()
CommonDialog1.ShowOpen
MFile = CommonDialog1.FileName
MediaPlayer1.FileName = MFile
MediaPlayer1.AutoStart = True
Label1.Caption = "00:00:00"
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Dim Drivename As String, I As Integer
temp = 1
hh = 0
mm = 0
ss = 0
Form1.Height = 4325
Form1.Width = 5100
MediaPlayer1.Top = 200
MediaPlayer1.Width = 4550
MediaPlayer1.Height = 3375
Label1.Left = (MediaPlayer1.Left + MediaPlayer1.Width - Label1.Width) * 0.8
Label1.Top = MediaPlayer1.Top + MediaPlayer1.Height - Label1.Height - 50
CommonDialog1.Filter = "影像文件(*.Avi;*.Mpg;*.Dat)|*.Avi;*.MPG;*.DAT"
On Error Resume Next
Drivename = ""
' 查找CD-ROM的驱动器号
For I = 65 To 90
If GetDriveType(Chr$(I) & ":\") = DRIVE_CDROM Then
Drivename = Chr$(I) & ":"
Exit For
End If
Next
If Drivename = "" Then
A = MsgBox("找不到 CD-ROM !", 0 + 16, "提示信息")
Else
MFile = Drivename + "\Mpegav\Music01.dat"
MediaPlayer1.FileName = MFile
MediaPlayer1.AutoStart = True
Label1.Caption = "00:00:00"
Timer1.Enabled = True
End If
End Sub
Private Sub Form_Resize()
If temp = 1 Then
Form1.Height = 4325
Form1.Width = 5100
MediaPlayer1.Width = 4550
MediaPlayer1.Height = 3375
Label1.Left = (MediaPlayer1.Left + MediaPlayer1.Width - Label1.Width) * 0.8
Label1.Top = MediaPlayer1.Top + MediaPlayer1.Height - Label1.Height - 50
Else
Form1.Height = 4325 * 2
Form1.Width = 5100 * 2
MediaPlayer1.Width = 4550 * 2 + 480
MediaPlayer1.Height = 3375 * 2 + 850
Label1.Left = (MediaPlayer1.Left + MediaPlayer1.Width - Label1.Width) * 0.8
Label1.Top = MediaPlayer1.Top + MediaPlayer1.Height - Label1.Height - 50
End If
End Sub
Private Sub full_Click()
If full.Checked = False Then
full.Checked = True
MediaPlayer1.EnableFullScreenControls = True
Else
full.Checked = False
MediaPlayer1.EnableFullScreenControls = False
End If
End Sub
Private Sub MediaPlayer1_PlayStateChange(ByVal OldState As Long, ByVal NewState As Long)
If NewState = 1 Then Timer1.Enabled = False
If NewState = 2 Then Timer1.Enabled = True
If NewState = 0 Then
Timer1.Enabled = False
hh = 0
ss = 0
mm = 0
End If
End Sub
Private Sub nommal_Click()
temp = 1
Form1.Height = 4125
Form1.Width = 5100
MediaPlayer1.Width = 4550
MediaPlayer1.Height = 3375
End Sub
Private Sub Timer1_Timer()
ss = ss + 1
If ss >= 60 Then
mm = mm + 1
ss = 0
If mm >= 60 Then
hh = hh + 1
mm = 0
End If
End If
Label1.Caption = Format$(hh, "00") + ":" + Format$(mm, "00") + ":" + Format$(ss, "00")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -