英语翻译Public i As IntegerPrivate Sub Command1_Click()Timer1.Enabled = TrueCommand1.Visible = FalseEnd SubPrivate Sub Command2_Click()If Command2.Caption = "停止" ThenLabel3.ForeColor = &HFF&Timer1.Enabled = FalseCommand2.Caption = "继续"Lis
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/21 00:53:03
英语翻译Public i As IntegerPrivate Sub Command1_Click()Timer1.Enabled = TrueCommand1.Visible = FalseEnd SubPrivate Sub Command2_Click()If Command2.Caption = "停止" ThenLabel3.ForeColor = &HFF&Timer1.Enabled = FalseCommand2.Caption = "继续"Lis
英语翻译
Public i As Integer
Private Sub Command1_Click()
Timer1.Enabled = True
Command1.Visible = False
End Sub
Private Sub Command2_Click()
If Command2.Caption = "停止" Then
Label3.ForeColor = &HFF&
Timer1.Enabled = False
Command2.Caption = "继续"
List2.AddItem Label3.Caption
List1.RemoveItem Label3.Tag
If List2.ListCount = 5 Then
For i = 0 To 4
msg = msg & "☆" & String(10," ") & List2.List(i) & String(10," ") & "☆" & vbCrLf
Next i
MsgBox msg,vbOKOnly,"中奖的号码为"
End If
Else
Timer1.Enabled = True
Command2.Caption = "停止"
Label3.ForeColor = &H0&
End If
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
fileno = FreeFile
Open App.Path & "\电话号码.txt" For Input As #fileno
Do While Not EOF(fileno)
Input #fileno,b
List1.AddItem b
Loop
Close #fileno
List1.Visible = False
End Sub
Private Sub Timer1_Timer()
i = i + 1
If i >= List1.ListCount Then i = 0
DoEvents
Label1.Caption = Label2.Caption
Label1.Tag = Label2.Tag
Label2.Caption = Label3.Caption
Label2.Tag = Label3.Tag
Label3.Caption = Label4.Caption
Label3.Tag = Label4.Tag
Label4.Caption = Label5.Caption
Label4.Tag = Label5.Tag
Label5.Caption = List1.List(i)
Label5.Tag = i
End Sub
Private Sub Timer2_Timer()
Static i As Single
i = i + 1
If i Mod 2 = 0 Then
Label6.ForeColor = &HFF&
Else
Label6.ForeColor = RGB(0,250,0)
End If
End Sub
英语翻译Public i As IntegerPrivate Sub Command1_Click()Timer1.Enabled = TrueCommand1.Visible = FalseEnd SubPrivate Sub Command2_Click()If Command2.Caption = "停止" ThenLabel3.ForeColor = &HFF&Timer1.Enabled = FalseCommand2.Caption = "继续"Lis
Public i As Integer '定义全局变量i
Private Sub Command1_Click() '按钮1点击事件
Timer1.Enabled = True '计时器Timer1的Enabled属性为真(即计时器生效)
Command1.Visible = False '按钮1Visible属性为假,即按钮1设置为不可见
End Sub
Private Sub Command2_Click() '按扭2事件
If Command2.Caption = "停止" Then '当按钮2的名称为"停止"时
Label3.ForeColor = &HFF& 'Label3(标签3)的文字颜色为红色
Timer1.Enabled = False '计时器停止
Command2.Caption = "继续" '按钮2的名称修改为 "继续"
List2.AddItem Label3.Caption '将标签3(Label3)的内容加入到List2中
List1.RemoveItem Label3.Tag '将标签3(Label3)的tag属性值从List1中移除
If List2.ListCount = 5 Then '当List2列表中的对象数量为5时
For i = 0 To 4 '循环0-4(5次循环)
msg = msg & "☆" & String(10," ") & List2.List(i) & String(10," ") & "☆" & vbCrLf
Next i ‘msg = msg + "☆" + 10个" " + List2中的一个对象 + 10个" " + "☆" + 换行
上述代码是读取List2中所有的信息
MsgBox msg,vbOKOnly,"中奖的号码为" '弹出消息对话框,显示msg这段文字
End If
Else '否则
Timer1.Enabled = True '计时器开始
Command2.Caption = "停止" '按钮2的名称设为 "停止"
Label3.ForeColor = &H0& '标签3的文字颜色为黑色
End If
End Sub
Private Sub Form_Load()
Timer1.Enabled = False '计时器停止
fileno = FreeFile
Open App.Path & "\电话号码.txt" For Input As #fileno ‘读取文本文件 电话号码.txt
Do While Not EOF(fileno) ’读到最后一行时结束
Input #fileno,b ‘读取txt文件中的一行内容
List1.AddItem b ’将这行内容加入到List1中
Loop
Close #fileno ‘关闭文本文件
List1.Visible = False ’List1设置为不可见
End Sub
Private Sub Timer1_Timer() '计时器1
i = i + 1
If i >= List1.ListCount Then i = 0 '当i的值大于List1中对象的数量时
DoEvents
Label1.Caption = Label2.Caption '标签1的内容 = 标签2的内容
Label1.Tag = Label2.Tag ‘标签1的tag值=标签2的tag值
Label2.Caption = Label3.Caption ’标签2的内容=标签3的内容
Label2.Tag = Label3.Tag '标签2的tag值=标签3的tag值
Label3.Caption = Label4.Caption ‘标签3的内容=标签4的内容
Label3.Tag = Label4.Tag '标签3的tag值=标签4的tag值
Label4.Caption = Label5.Caption ‘标签4的内容=标签5的内容
Label4.Tag = Label5.Tag '标签4的tag值=标签5的tag值
Label5.Caption = List1.List(i) ’标签5的内容 = List1中的一行
Label5.Tag = i '标签5的tag值=i
End Sub
Private Sub Timer2_Timer() '计时器2
Static i As Single '定义静态变量 i
i = i + 1
If i Mod 2 = 0 Then '如果i为偶数
Label6.ForeColor = &HFF& '标签6的字体颜色为红色
Else '否则
Label6.ForeColor = RGB(0,250,0) '标签6的字体颜色为 RGB(0,250,0)
End If
End Sub
这段代码应该是一个以动画形式显示的动态抽奖程序