VB语言翻译,求大婶
PrivateSubForm_KeyDown(KeyCodeAsInteger,ShiftAsInteger)DimCAsLongIfKeyCode=27ThenEndI...
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim C As Long
If KeyCode = 27 Then End
If KeyCode = 32 Then
If Timer1.Enabled = True Then
Timer1.Enabled = False
Label1.Visible = True
Else
Timer1.Enabled = True
Label1.Visible = False
End If
End If
C = UBound(She)
If GFangXiang = True Then Exit Sub
Select Case KeyCode
Case 37
If She(C).F = 2 Then Exit Sub
She(C).F = 0
GFangXiang = True
Case 38
If She(C).F = 3 Then Exit Sub
She(C).F = 1
GFangXiang = True
Case 39
If She(C).F = 0 Then Exit Sub
She(C).F = 2
GFangXiang = True
Case 40
If She(C).F = 1 Then Exit Sub
She(C).F = 3
GFangXiang = True
End Select
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
Me.BackColor = &HC000&
Me.FillColor = 255
Me.FillStyle = 0
Me.ScaleWidth = 24
Me.ScaleHeight = 24
Me.WindowState = 2
Set Timer1 = Controls.Add("VB.Timer", "Timer1")
Set Label1 = Controls.Add("VB.Label", "Label1")
Label1.AutoSize = True
Label1.BackStyle = 0
Label1 = "暂停"
Label1.ForeColor = RGB(255, 255, 0)
Label1.FontSize = 50
ChuShiHua
End Sub
后面还有,发不了这么多,先求大神 展开
Dim C As Long
If KeyCode = 27 Then End
If KeyCode = 32 Then
If Timer1.Enabled = True Then
Timer1.Enabled = False
Label1.Visible = True
Else
Timer1.Enabled = True
Label1.Visible = False
End If
End If
C = UBound(She)
If GFangXiang = True Then Exit Sub
Select Case KeyCode
Case 37
If She(C).F = 2 Then Exit Sub
She(C).F = 0
GFangXiang = True
Case 38
If She(C).F = 3 Then Exit Sub
She(C).F = 1
GFangXiang = True
Case 39
If She(C).F = 0 Then Exit Sub
She(C).F = 2
GFangXiang = True
Case 40
If She(C).F = 1 Then Exit Sub
She(C).F = 3
GFangXiang = True
End Select
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
Me.BackColor = &HC000&
Me.FillColor = 255
Me.FillStyle = 0
Me.ScaleWidth = 24
Me.ScaleHeight = 24
Me.WindowState = 2
Set Timer1 = Controls.Add("VB.Timer", "Timer1")
Set Label1 = Controls.Add("VB.Label", "Label1")
Label1.AutoSize = True
Label1.BackStyle = 0
Label1 = "暂停"
Label1.ForeColor = RGB(255, 255, 0)
Label1.FontSize = 50
ChuShiHua
End Sub
后面还有,发不了这么多,先求大神 展开
2个回答
展开全部
一个按键处理事件而已。
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim C As Long ’定义C为长整型变量
If KeyCode = 27 Then End ‘如果按ESC键就终止程序
If KeyCode = 32 Then ’如果按下空格建,显示/隐藏timer1并隐藏/显示lable1
If Timer1.Enabled = True Then
Timer1.Enabled = False
Label1.Visible = True
Else
Timer1.Enabled = True
Label1.Visible = False
End If
End If
C = UBound(She) 'C取得She数组的最大下标,不知道She定义
If GFangXiang = True Then Exit Sub
Select Case KeyCode ‘还是按键,根据按下不同的建,为she最后一个元素的.F属性赋值,并修改GFangXiang的值
Case 37 ’如果按下“左箭头”
If She(C).F = 2 Then Exit Sub
She(C).F = 0
GFangXiang = True
Case 38 ‘如果按“上箭头”
If She(C).F = 3 Then Exit Sub
She(C).F = 1
GFangXiang = True
Case 39 如果按“右箭头”
If She(C).F = 0 Then Exit Sub
She(C).F = 2
GFangXiang = True
Case 40 如果按“下箭头”
If She(C).F = 1 Then Exit Sub
She(C).F = 3
GFangXiang = True
End Select
End Sub
Private Sub Form_Load() ’装入窗体时候先设置窗体的样式
Me.AutoRedraw = True
Me.BackColor = &HC000&
Me.FillColor = 255
Me.FillStyle = 0
Me.ScaleWidth = 24
Me.ScaleHeight = 24
Me.WindowState = 2
Set Timer1 = Controls.Add("VB.Timer", "Timer1") ‘在窗体中加入计时器控件timer1
Set Label1 = Controls.Add("VB.Label", "Label1") ’加入Label1文本标签
Label1.AutoSize = True '设置标签的样式
Label1.BackStyle = 0
Label1 = "暂停"
Label1.ForeColor = RGB(255, 255, 0)
Label1.FontSize = 50
ChuShiHua ‘这里应该是个初始化事件
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim C As Long ’定义C为长整型变量
If KeyCode = 27 Then End ‘如果按ESC键就终止程序
If KeyCode = 32 Then ’如果按下空格建,显示/隐藏timer1并隐藏/显示lable1
If Timer1.Enabled = True Then
Timer1.Enabled = False
Label1.Visible = True
Else
Timer1.Enabled = True
Label1.Visible = False
End If
End If
C = UBound(She) 'C取得She数组的最大下标,不知道She定义
If GFangXiang = True Then Exit Sub
Select Case KeyCode ‘还是按键,根据按下不同的建,为she最后一个元素的.F属性赋值,并修改GFangXiang的值
Case 37 ’如果按下“左箭头”
If She(C).F = 2 Then Exit Sub
She(C).F = 0
GFangXiang = True
Case 38 ‘如果按“上箭头”
If She(C).F = 3 Then Exit Sub
She(C).F = 1
GFangXiang = True
Case 39 如果按“右箭头”
If She(C).F = 0 Then Exit Sub
She(C).F = 2
GFangXiang = True
Case 40 如果按“下箭头”
If She(C).F = 1 Then Exit Sub
She(C).F = 3
GFangXiang = True
End Select
End Sub
Private Sub Form_Load() ’装入窗体时候先设置窗体的样式
Me.AutoRedraw = True
Me.BackColor = &HC000&
Me.FillColor = 255
Me.FillStyle = 0
Me.ScaleWidth = 24
Me.ScaleHeight = 24
Me.WindowState = 2
Set Timer1 = Controls.Add("VB.Timer", "Timer1") ‘在窗体中加入计时器控件timer1
Set Label1 = Controls.Add("VB.Label", "Label1") ’加入Label1文本标签
Label1.AutoSize = True '设置标签的样式
Label1.BackStyle = 0
Label1 = "暂停"
Label1.ForeColor = RGB(255, 255, 0)
Label1.FontSize = 50
ChuShiHua ‘这里应该是个初始化事件
End Sub
追问
谢了,还有一小部分,一会用电脑发给你
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询