📄 红绿灯.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 3 'Fixed Dialog
Caption = "红绿灯"
ClientHeight = 4875
ClientLeft = 45
ClientTop = 435
ClientWidth = 3075
Icon = "红绿灯.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4875
ScaleWidth = 3075
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Timer Timer1
Interval = 1000
Left = 1860
Top = 120
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "1"
BeginProperty Font
Name = "MS Serif"
Size = 48.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1200
Left = 1920
TabIndex = 1
Top = 1800
Width = 465
End
Begin VB.Label Label1
Caption = "1"
Height = 315
Left = 2400
TabIndex = 0
Top = 120
Visible = 0 'False
Width = 255
End
Begin VB.Shape Shape3
BackColor = &H0000FF00&
BackStyle = 1 'Opaque
Height = 1395
Left = 180
Shape = 3 'Circle
Top = 3240
Visible = 0 'False
Width = 1755
End
Begin VB.Shape Shape2
BackColor = &H0000FFFF&
BackStyle = 1 'Opaque
Height = 1395
Left = 180
Shape = 3 'Circle
Top = 1680
Visible = 0 'False
Width = 1755
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
BackStyle = 1 'Opaque
Height = 1395
Left = 180
Shape = 3 'Circle
Top = 120
Width = 1755
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Timer1_Timer()
Dim i As Single
Dim j As Integer
i = Label1.Caption
Label1.Caption = i + 1
If i < 30 Then
Shape1.Visible = True
Shape3.Visible = False
End If
If i > 29 And i < 33 Then
Shape1.Visible = False
Shape2.Visible = True
End If
If i > 32 Then
Shape3.Visible = True
Shape2.Visible = False
End If
If i > 61 Then
Label1.Caption = 1
End If
j = Label2.Caption
If i = 30 Then
j = 0
End If
If i = 33 Then
j = 0
End If
If j = 30 Then
j = 0
End If
Label2.Caption = j + 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -