http://bbs.iyaya.com/99/276820.htm
参考资料:http://bbs.iyaya.com/99/276820.htm
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Form_Load()
For I = 0 To 5
Label1(I).FontSize = 48
Next I
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Randomize
For I = 0 To 5
Randomize
Label1(I).Caption = Int(Rnd() * 10)
Next I
End Sub
2.计算机
Dim w1
Dim w2
Dim S
Dim t1
Dim t2
Dim t3
Dim w3
Dim t4
Private Sub Command1_Click()
Text1 = Text1 & Command1.Caption
End Sub
Private Sub Command10_Click()
Text1 = Text1 & Command10.Caption
End Sub
Private Sub Command11_Click()
S = S + Val(Text1)
Text1 = ""
t1 = True
t2 = False
t3 = False
t4 = False
End Sub
Private Sub Command12_Click()
If w1 = False Then
S = Val(Text1)
w1 = True
S = S - Val(Text1)
Text1 = ""
t1 = False
t2 = True
t3 = False
t4 = False
Else
S = S - Val(Text1)
Text1 = ""
t1 = False
t2 = True
t3 = False
t4 = False
End If
End Sub
Private Sub Command13_Click()
If w3 = False Then
S = Val(Text1)
w3 = True
Text1 = ""
t1 = False
t2 = False
t3 = True
t4 = False
Else
S = S * Val(Text1)
Text1 = ""
t1 = False
t2 = False
t3 = True
t4 = False
End If
End Sub
Private Sub Command14_Click()
If w2 = False Then
S = Val(Text1)
w2 = True
Text1 = ""
t1 = False
t2 = False
t3 = False
t4 = True
Else
S = S / Val(Text1)
Text1 = ""
t1 = False
t2 = False
t3 = False
t4 = True
End If
End Sub
Private Sub Command15_Click()
S = Sqr(S)
Text1 = Str(S)
End Sub
Private Sub Command16_Click()
w1 = False
w2 = False
w3 = False
Command16.Caption = "复位"
S = 0
Text1 = ""
End Sub
Private Sub Command17_Click()
If t1 = True Then
S = S + Val(Text1)
Text1 = Str(S)
ElseIf t2 = True Then
S = S - Val(Text1)
Text1 = Str(S)
ElseIf t3 = True Then
S = S * Val(Text1)
Text1 = Str(S)
Else
S = S / Val(Text1)
Text1 = Str(S)
End If
End Sub
Private Sub Command2_Click()
Text1 = Text1 & Command2.Caption
End Sub
Private Sub Command3_Click()
Text1 = Text1 & Command3.Caption
End Sub
Private Sub Command4_Click()
Text1 = Text1 & Command4.Caption
End Sub
Private Sub Command5_Click()
Text1 = Text1 & Command5.Caption
End Sub
Private Sub Command6_Click()
Text1 = Text1 & Command6.Caption
End Sub
Private Sub Command7_Click()
Text1 = Text1 & Command7.Caption
End Sub
Private Sub Command8_Click()
Text1 = Text1 & Command8.Caption
End Sub
Private Sub Command9_Click()
Text1 = Text1 & Command9.Caption
End Sub
Private Sub Form_Load()
t1 = False
t2 = False
t3 = False
t4 = False
t6 = False
t7 = False
End Sub
3。打方块小游戏
注意timer1和timer2开始时ENABLED属性设置为FALSE
Private Sub Command1_Click()
Timer1.Interval = 900
End Sub
Private Sub Command2_Click()
Timer1.Interval = 600
End Sub
Private Sub Command3_Click()
Timer1.Interval = 500
End Sub
Private Sub Command4_Click()
Timer2.Enabled = True
Timer1.Enabled = True
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command5.Visible = True
Timer2.Interval = 1000
End Sub
Private Sub Command5_Click()
Static r
r = r + 1
Text2 = Str(r)
End Sub
Private Sub Timer1_Timer()
Randomize
a = Int(Rnd() * 255)
b = Int(Rnd() * 255)
c = Int(Rnd() * 255)
d = Int(Rnd() * 9495)
e = Int(Rnd() * 10935)
Command5.BackColor = RGB(a, b, c)
Command5.Move d, e
End Sub
Private Sub Timer2_Timer()
Static i
i = i + 1
Text1 = Str(30 - i)
If i = 30 Then
Timer1.Enabled = False
Timer2.Enabled = False
Command5.Visible = False
i = 0
r = 0
End If
End Sub
成熟的软件设计最后是要把生成的EXE文件做成安装程序发布到网上的。当然要安装了。
编译 :只有你可以用;
安装:是编译和测试成功后生成的运行程序,可以移置其他电脑使用
生成的运行程序