📄 form1.frm
字号:
End If
If index = 2 Then
next_module_show picture2(1), mdltype_number, mdl_creat
End If
'显示下一个方块
If terminuscheck.terminus_check(dmv.module_top_x, dmv.module_top_y, dmv.module_type, record) = 1 Then
'确定方块是否到达终点
If terminuscheck.end_check(dmv.module_top_x) = 1 Then
If index = 1 Then
left_renew
Else
right_renew
'重新布置整个窗口
End If
end_cope picture
'游戏已经结束,引起的变化
Else
line_delete picture, dmv, record, mdltype_number, index
End If
Else '方块未达到终点
dmv.give_value dmv.module_top_x + 1, dmv.module_top_y, dmv.module_type, dmv.module_color_type
End If
End Sub
'实现全屏各个功能
Private Sub fullscreen()
cmdfullscreen(0).Caption = "恢复"
mnushortcut1fullscreen.Enabled = False
mnushortcut1recover.Enabled = True
'按下该键后各控件的可行状态
cmdfullscreen(1).Caption = "恢复"
mnushortcut2fullscreen.Enabled = False
mnushortcut2recover.Enabled = True
'实现右半部的“全屏”键以及快捷菜单中“全屏”和“恢复”键的变化
If mnusinglegame.Enabled = True Then
a.fullscreen Picture1(0), Picture1(1), left_record, right_record, left_dmv, right_dmv
'实现双人游戏全屏的功能
Else
a.singlegame_fullscreen Picture1(0), left_record, left_dmv
'实现单人游戏全屏的功能
End If
End Sub
'实现恢复各个功能
Private Sub recover()
cmdfullscreen(0).Caption = "全屏"
mnushortcut1recover.Enabled = False
mnushortcut1fullscreen.Enabled = True
'实现左半部的“全屏”键以及快捷菜单中“全屏”和“恢复”键的变化
cmdfullscreen(1).Caption = "全屏"
mnushortcut2recover.Enabled = False
mnushortcut2fullscreen.Enabled = True
'实现右半部的“全屏”键以及快捷菜单中“全屏”和“恢复”键的变化
a.recover Picture1(0), Picture1(1), left_record, right_record, left_dmv, right_dmv
'按下该键后各控件的可行状态
End Sub
'实现左边游戏重新功能,选择游戏类型之后各个控件的变化
Private Sub left_renew()
cmdstart(0).Caption = "开始"
cmdrenew(0).Enabled = False
mnushortcut1start.Enabled = True
mnushortcut1pause.Enabled = False
mnushortcut1renew.Enabled = False
'窗体启动设置时间,速度指示器为0
tmrtime1.Enabled = False '记数时间的功能
tmrleft.Enabled = False '游戏左边的时间功能
left_record.clear
End Sub
'实现右边游戏重新功能,选择游戏类型之后各个控件的变化
Private Sub right_renew()
cmdstart(1).Caption = "开始"
cmdrenew(1).Enabled = False
mnushortcut2start.Enabled = True
mnushortcut2pause.Enabled = False
mnushortcut2renew.Enabled = False
'窗体启动设置时间,速度指示器为0
tmrtime2.Enabled = False '记数时间的功能
tmrright.Enabled = False '游戏右边的时间功能
right_record.clear
End Sub
'实现暂停功能
Private Sub pause(mnupause As Menu, cmdstart As CommandButton, time1 As Timer, time2 As Timer)
mnupause.Caption = "继续"
cmdstart.Caption = "继续"
time1.Enabled = False
time2.Enabled = False
End Sub
'实现开始功能
Private Sub start(cmdrenew As CommandButton, cmdstart As CommandButton, mnurenew As Menu, mnustart As Menu, mnupause As Menu, time1 As Timer, time2 As Timer, index As Integer)
'index用于指示是哪一个游戏
cmdrenew.Enabled = True
cmdstart.Caption = "暂停"
mnurenew.Enabled = True
mnustart.Enabled = False
mnupause.Enabled = True
time1.Enabled = True
time2.Enabled = True '计时的效果
If index = 1 Then
vehicle lblspeed(0), tmrleft
left_score_clear '将分数等清空
top_show left_mdltype_number, mdl_creat, left_dmv
Else
vehicle lblspeed(1), tmrright
right_score_clear '将分数等清空
top_show right_mdltype_number, mdl_creat, right_dmv
End If
'顶部产生方块
End Sub
'实现继续功能
Private Sub continue(cmdstart As CommandButton, mnupause As Menu, time1 As Timer, time2 As Timer)
cmdstart.Caption = "暂停"
mnupause.Caption = "暂停"
time1.Enabled = True
time2.Enabled = True
End Sub
Private Sub cmdfullscreen_Click(index As Integer)
If index = 0 Then
If cmdfullscreen(0).Caption = "全屏" Then
fullscreen
Else
recover
End If
End If
If index = 1 Then
If cmdfullscreen(1).Caption = "全屏" Then
fullscreen
Else
recover
End If
End If
Picture1(0).SetFocus '使焦点落在picture1(0)上
End Sub
Private Sub cmdrenew_Click(index As Integer)
If index = 0 Then
left_renew
End If
If index = 1 Then
right_renew
End If
Picture1(0).SetFocus '使焦点落在picture1(0)上
End Sub
Private Sub cmdstart_Click(index As Integer)
If index = 0 Then
If cmdstart(0).Caption = "开始" Then
start cmdrenew(0), cmdstart(0), mnushortcut1renew, mnushortcut1start, mnushortcut1pause, tmrleft, tmrtime1, 1
Else
If cmdstart(0).Caption = "暂停" Then
pause mnushortcut1pause, cmdstart(0), tmrleft, tmrtime1
Else
If cmdstart(0).Caption = "继续" Then
continue cmdstart(0), mnushortcut1pause, tmrleft, tmrtime1
End If
End If
End If
End If
'当该键的名称为暂停,按下该键后各控件的可行状态
If index = 1 Then
If cmdstart(1).Caption = "开始" Then
start cmdrenew(1), cmdstart(1), mnushortcut2renew, mnushortcut2start, mnushortcut2pause, tmrright, tmrtime2, 2
Else
If cmdstart(1).Caption = "暂停" Then
pause mnushortcut2pause, cmdstart(1), tmrright, tmrtime2
Else
If cmdstart(1).Caption = "继续" Then
continue cmdstart(1), mnushortcut2pause, tmrright, tmrtime2
End If
End If
End If
End If
'当该键的名称为开始,按下该键后各控件的可行状态
Picture1(0).SetFocus '使s焦点落在picture1(0)上
End Sub
Private Sub Form_Load()
mnushortcut1.Visible = False
mnushortcut2.Visible = False
'快捷键1,2隐藏
Form1.Show
frmtheme.Show 1, Form1
Form2.Show 1, Form1
If Form2.doublegame = 1 Then
mnusinglegame.Enabled = True
mnudoublegame.Enabled = False
Form1.Width = 8280
Else
mnudoublegame.Enabled = True
mnusinglegame.Enabled = False
Form1.Width = 4200
End If
'窗体启动且确定了哪一种游戏后的主窗体形态
left_score_clear
lblspeed(0).Caption = 0
right_score_clear
lblspeed(1).Caption = 0
'将分数等清空
cmdrenew(0).Enabled = False
cmdrenew(1).Enabled = False
mnushortcut1pause.Enabled = False
mnushortcut2pause.Enabled = False
mnushortcut1renew.Enabled = False
mnushortcut2renew.Enabled = False
mnushortcut1recover.Enabled = False
mnushortcut2recover.Enabled = False
'窗体启动后各控件的可行状态
'cmdfullscreen(0).picture = LoadPicture(App.Path + "\facebmp.bmp")
'cmdfullscreen(1).picture = LoadPicture(App.Path + "\facebmp.bmp")
'cmdrenew(0).picture = LoadPicture(App.Path + "\facebmp.bmp")
'cmdrenew(1).picture = LoadPicture(App.Path + "\facebmp.bmp")
'cmdstart(0).picture = LoadPicture(App.Path + "\facebmp.bmp")
'cmdstart(1).picture = LoadPicture(App.Path + "\facebmp.bmp")
'设置命令控件的背景图片
tmrtime1.Enabled = False
tmrtime2.Enabled = False
tmrleft.Enabled = False
tmrright.Enabled = False
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If end_precope = 1 Then
Cancel = 0
Else: Cancel = 1
End If
End Sub
Private Sub Form_Resize()
If Form1.WindowState = 0 Then
recover
End If
End Sub
Private Sub mnudoublegame_Click()
mnusinglegame.Enabled = True
mnudoublegame.Enabled = False
left_renew
right_renew
'按下该键后各控件的可行状态
If Form1.WindowState = 0 Then
Form1.Width = 8280
Else
recover
Form1.Width = 8280
End If
'改变窗体的大小
left_record.clear
tmrleft.Enabled = False
right_record.clear
tmrright.Enabled = False
'将左右边游戏的布局记录清空,时间
End Sub
Private Sub mnuend_Click()
If end_precope = 2 Then
Form1.Show
Else
End
End If
End Sub
Private Sub mnuhelptopic_Click()
frmtheme.Show
End Sub
Private Sub mnuproductintroduction_Click()
frmtheme.Show
End Sub
Private Sub mnushortcut1fullscreen_Click()
fullscreen
End Sub
Private Sub mnushortcut1pause_Click()
If mnushortcut1pause.Caption = "暂停" Then
pause mnushortcut1pause, cmdstart(0), tmrleft, tmrtime1
Else
If mnushortcut1pause.Caption = "继续" Then
continue cmdstart(0), mnushortcut1pause, tmrleft, tmrtime1
End If
End If
'按下该键后各控件的可行状态
End Sub
Private Sub mnushortcut1recover_Click()
recover
End Sub
Private Sub mnushortcut1renew_Click()
left_renew
End Sub
Private Sub mnushortcut1start_Click()
start cmdrenew(0), cmdstart(0), mnushortcut1renew, mnushortcut1start, mnushortcut1pause, tmrleft, tmrtime1, 1
End Sub
Private Sub mnushortcut2fullscreen_Click()
fullscreen
End Sub
Private Sub mnushortcut2pause_Click()
If mnushortcut2pause.Caption = "暂停" Then
pause mnushortcut2pause, cmdstart(1), tmrright, tmrtime2
Else
If mnushortcut2pause.Caption = "继续" Then
continue cmdstart(1), mnushortcut2pause, tmrright, tmrtime2
End If
End If
'按下该键后各控件的可行状态
End Sub
Private Sub mnushortcut2recover_Click()
recover
End Sub
Private Sub mnushortcut2renew_Click()
right_renew
End Sub
Private Sub mnushortcut2start_Click()
start cmdrenew(1), cmdstart(1), mnushortcut2renew, mnushortcut2start, mnushortcut2pause, tmrright, tmrtime2, 2
End Sub
Private Sub mnusinglegame_Click()
mnusinglegame.Enabled = False
mnudoublegame.Enabled = True
left_renew
'按下该键后各控件的可行状态
If Form1.WindowState = 0 Then
Form1.Width = 4200
Else
recover
Form1.Width = 4200
End If
'改变窗体的大小
left_record.clear
tmrleft.Enabled = False
'将左边游戏的布局记录清空,时间
End Sub
Private Sub Picture1_KeyDown(index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = 112 Then '按全屏幕的快捷键F1
cmdfullscreen_Click 1
End If
If KeyCode = 113 Then '按左边游戏开始的快捷键F2
cmdstart_Click 0
End If
If KeyCode = 114 Then '按右边游戏开始的快捷键F3
cmdstart_Click 1
End If
operator KeyCode '控制键的操作
End Sub
Private Sub Picture1_MouseDown(index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
If index = 0 Then
If Button = 2 Then
PopupMenu mnushortcut1
End If
End If
'按鼠标右键后弹出菜单
If index = 1 Then
If Button = 2 Then
PopupMenu mnushortcut2
End If
End If
'按鼠标右键后弹出菜单
End Sub
Private Sub tmrleft_Timer()
altogether_timer Picture1(0), left_dmv, left_record, left_mdltype_number, 1
End Sub
Private Sub tmrright_Timer()
altogether_timer Picture1(1), right_dmv, right_record, right_mdltype_number, 2
End Sub
Private Sub tmrtime1_Timer()
lbltime(0).Caption = Val(lbltime(0).Caption) + 1
show_operate_vehicle lblscore(0), lbltime(0), lbloperator(0), ProgressBar1(0)
End Sub
Private Sub tmrtime2_Timer()
lbltime(1).Caption = Val(lbltime(1).Caption) + 1
show_operate_vehicle lblscore(1), lbltime(1), lbloperator(1), ProgressBar1(1)
End Sub
Private Sub UpDown1_Change(index As Integer)
If index = 0 Then
vehicle lblspeed(0), tmrleft '调节速度
left_original_vehicical_grade = Val(lblspeed(0)) '改变关数,用于score_show模块
End If
'按住该键引起速度变快
If index = 1 Then
vehicle lblspeed(1), tmrright '调节速度
right_original_vehicical_grade = Val(lblspeed(1)) '改变关数,用于score_show模块
End If
'按住该键引起速度变快
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -