介绍一个VB小的有趣的程序代码
发布网友
发布时间:2022-04-25 00:03
我来回答
共3个回答
热心网友
时间:2023-10-16 13:01
'万花筒程序
'粘贴下面代码即可, 不用添加任何控件
Private WithEvents Timer1 As Timer
Dim r&, r1&, t&, a1!, a2!, xb!, yb!, s!, b#
Private Sub Form_Load()
Me.Width = 4500: Me.Height = 4500
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
Me.AutoRedraw = True
Me.Caption = "CBM666的万花筒"
Set Timer1 = Controls.Add("vb.timer", "Timer1")
Timer1.Interval = 10
End Sub
Private Sub Timer1_Timer()
Randomize
r = 340 * Rnd
If r <> 0 Then
r1 = 500
s = r * Rnd
b = RGB(256 * Rnd, 256 * Rnd, 256 * Rnd)
For t = 1 To 10000
a1 = t * 3.1415926 / 180
a2 = (r1 / r) * a1
xb = 500 + (-(r1 - r) * Cos(a1) - s * Cos(a2 - a1) + 420) * 4
yb = 500 + ((r1 - r) * Sin(a1) - s * Sin(a2 - a1) + 380) * 4
Me.PSet (xb, yb), b
Next t
End If
End Sub
参考资料:http://hi.baidu.com/cbm666/blog/item/01aa8bd4ec770900a08bb722.html
热心网友
时间:2023-10-16 13:01
'万花筒程序
'粘贴下面代码即可, 不用添加任何控件
Private WithEvents Timer1 As Timer
Dim r&, r1&, t&, a1!, a2!, xb!, yb!, s!, b#
Private Sub Form_Load()
Me.Width = 4500: Me.Height = 4500
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
Me.AutoRedraw = True
Me.Caption = "CBM666的万花筒"
Set Timer1 = Controls.Add("vb.timer", "Timer1")
Timer1.Interval = 10
End Sub
Private Sub Timer1_Timer()
Randomize
r = 340 * Rnd
If r <> 0 Then
r1 = 500
s = r * Rnd
b = RGB(256 * Rnd, 256 * Rnd, 256 * Rnd)
For t = 1 To 10000
a1 = t * 3.1415926 / 180
a2 = (r1 / r) * a1
xb = 500 + (-(r1 - r) * Cos(a1) - s * Cos(a2 - a1) + 420) * 4
yb = 500 + ((r1 - r) * Sin(a1) - s * Sin(a2 - a1) + 380) * 4
Me.PSet (xb, yb), b
Next t
End If
End Sub
热心网友
时间:2023-10-16 13:02
一些VB小游戏吧……例如
FaceCatch,LetterTile,LuckySeven等等
都差不多,就看你能不能把它做得有趣而已。