📄 main.frm
字号:
VERSION 5.00
Object = "{22D6F304-B0F6-11D0-94AB-0080C74C7E95}#1.0#0"; "msdxm.ocx"
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
BorderStyle = 0 'None
Caption = "IMFB"
ClientHeight = 5670
ClientLeft = 0
ClientTop = 0
ClientWidth = 7485
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5670
ScaleWidth = 7485
StartUpPosition = 2 'CenterScreen
Begin VB.Timer Timer1
Interval = 40
Left = 3120
Top = 5760
End
Begin MSCommLib.MSComm MSComm1
Left = 3960
Top = 5760
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
InBufferSize = 2
StopBits = 2
End
Begin MediaPlayerCtl.MediaPlayer MediaPlayer2
Height = 5655
Left = 0
TabIndex = 1
Top = 0
Width = 7455
AudioStream = -1
AutoSize = 0 'False
AutoStart = -1 'True
AnimationAtStart= -1 'True
AllowScan = -1 'True
AllowChangeDisplaySize= -1 'True
AutoRewind = 0 'False
Balance = 0
BaseURL = ""
BufferingTime = 3
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= -1 'True
SendMouseClickEvents= 0 'False
SendMouseMoveEvents= 0 'False
SendPlayStateChangeEvents= -1 'True
ShowCaptioning = 0 'False
ShowControls = 0 'False
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 = 0
WindowlessVideo = 0 'False
End
Begin MediaPlayerCtl.MediaPlayer MediaPlayer1
Height = 5655
Left = 0
TabIndex = 0
Top = 0
Width = 7455
AudioStream = -1
AutoSize = 0 'False
AutoStart = -1 'True
AnimationAtStart= -1 'True
AllowScan = -1 'True
AllowChangeDisplaySize= -1 'True
AutoRewind = 0 'False
Balance = 0
BaseURL = ""
BufferingTime = 3
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 = 0 'False
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 = -950
WindowlessVideo = 0 'False
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim OutBuffer As Variant
Dim InBuffer As String
Dim Comdate(1) As Integer
Dim CtrlChar() As Byte
Dim i As Integer
Dim AreaID As Integer
Dim LevelID As String
Dim UpNum As Integer
Dim LowNum As Integer
Dim Num As Integer
Dim YN As String
Private Sub Form_Load()
Form1.Width = Screen.Width
Form1.Height = Screen.Height
MediaPlayer1.Width = Form1.Width
MediaPlayer1.Height = Form1.Height
MediaPlayer2.Width = Form1.Width
MediaPlayer2.Height = Form1.Height
'串口初始化
MSComm1.CommPort = 2
MSComm1.Settings = "4800,n,8,2"
MSComm1.InputLen = 0
MSComm1.InputMode = comInputModeText
MSComm1.InBufferSize = 4
MSComm1.OutBufferSize = 2
MSComm1.InBufferCount = 0
MSComm1.OutBufferCount = 0
MSComm1.PortOpen = True
MediaPlayer1.Visible = False
'MediaPlayer1.DisplayMode = mpFrames
MediaPlayer1.DisplaySize = mpFitToSize
LevelID = "a"
UpNum = 30
LowNum = -70
Randomize
MediaPlayer2.Open (App.Path & "\Football\Still\" & LevelID & "01.bmp")
'MediaPlayer2.DisplayMode = mpFrames
'MediaPlayer2.DisplaySize = mpFullScreen
MediaPlayer2.DisplaySize = mpFitToSize
End Sub
Private Sub MediaPlayer1_EndOfStream(ByVal Result As Long)
MediaPlayer1.Visible = False
MediaPlayer1.DisplaySize = mpFitToSize
MediaPlayer2.Visible = True
MediaPlayer2.DisplaySize = mpFullScreen
Timer1.Enabled = True
OutBuffer = Chr(128)
MSComm1.Output = OutBuffer
End Sub
Private Sub MediaPlayer2_KeyPress(CharacterCode As Integer)
If CharacterCode = vbKeyEscape Then End
End Sub
Private Sub Timer1_Timer()
If MSComm1.InBufferCount > 0 Then
InBuffer = MSComm1.Input
CtrlChar = StrConv(InBuffer, vbFromUnicode)
For i = LBound(CtrlChar) To UBound(CtrlChar)
Comdate(i) = CtrlChar(i)
Next i
MSComm1.InBufferCount = 0
If i = 1 Then
If Comdate(0) = 1 Then
LevelID = "a"
UpNum = 30
LowNum = -70
End If
If Comdate(0) = 2 Then
LevelID = "b"
UpNum = 40
LowNum = -60
End If
If Comdate(0) = 3 Then
LevelID = "c"
UpNum = 60
LowNum = -40
End If
Sleep 1000
MediaPlayer2.Open (App.Path & "\Football\Still\" & LevelID & "01.bmp")
OutBuffer = Chr(96)
MSComm1.Output = OutBuffer
End If
If i = 2 And Comdate(0) > 0 And Comdate(1) > 0 Then
InitArray Comdate(0), Comdate(1)
Else
OutBuffer = Chr(128)
MSComm1.Output = OutBuffer
End If
End If
End Sub
Sub InitArray(x As Integer, y As Integer)
Timer1.Enabled = False
If (x > 0 And x < 4) And (y > 0 And y < 5) Then AreaID = 1
If (x > 0 And x < 4) And (y > 4 And y < 9) Then AreaID = 2
If (x > 0 And x < 4) And (y > 8 And y < 13) Then AreaID = 3
If (x > 3 And x < 7) And (y > 0 And y < 7) Then AreaID = 4
If (x > 3 And x < 7) And (y > 6 And y < 13) Then AreaID = 5
If (x > 6 And x < 11) And (y > 0 And y < 7) Then AreaID = 6
If (x > 6 And x < 11) And (y > 6 And y < 13) Then AreaID = 7
If (x > 10 And x < 14) And (y > 0 And y < 7) Then AreaID = 8
If (x > 10 And x < 14) And (y > 6 And y < 13) Then AreaID = 9
If (x > 13 And x < 17) And (y > 0 And y < 5) Then AreaID = 10
If (x > 13 And x < 17) And (y > 4 And y < 9) Then AreaID = 11
If (x > 13 And x < 17) And (y > 8 And y < 13) Then AreaID = 12
Play
End Sub
Sub Play()
Num = Int((UpNum - LowNum + 1) * Rnd + LowNum)
If Num > 0 Or Num = 0 Then
YN = "yes"
Else
YN = "no"
End If
Debug.Print UpNum, LowNum
MediaPlayer1.Open (App.Path & "\Football\" & LevelID & "\" & AreaID & YN & ".avi")
MediaPlayer2.Visible = False
MediaPlayer1.Visible = True
MediaPlayer1.DisplaySize = mpFullScreen
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -