VB 语言做雪花

VB 语言做雪花,第1张

Dim Snow(1000, 2), Amounty As Integer Private Sub Form_Load() Form1.Show DoEvents Randomize Amounty = 325 For J = 1 To Amounty Snow(J, 0) = Int(Rnd * Form1.Width) Snow(J, 1) = Int(Rnd * Form1.Height) Snow(J, 2) = 10 + (Rnd * 20) Next J Do While Not (DoEvents = 0) For LS = 1 To 10 For I = 1 To Amounty OldX = Snow(I, 0): OldY = Snow(I, 1) Snow(I, 1) = Snow(I, 1) + Snow(I, 2) If Snow(I, 1) >Form1.Height Then Snow(I, 1) = 0: Snow(I, 2) = 5 + (Rnd * 30) Snow(I, 0) = Int(Rnd * Form1.Width) OldX = 0: OldY = 0 End If Coloury = 8 * (Snow(I, 2) - 10): Coloury = 60 + Coloury PSet (OldX, OldY), Form1.BackColor PSet (Snow(I, 0), Snow(I, 1)), RGB(Coloury, Coloury, Coloury) Next I Next LS Cls Loop End End Sub

Private Sub Form_Click() '点击窗体运行

Dim x As Integer, y As Integer

For y = 1 没粗To 5 '设长禅段方形的高为5

    For x = 1 To 10 '设长方形的宽为10

        Print Tab(x)

        If x = 1 Or x = 10 Or y = 1 Or y = 5 Then Print "贺察誉*"

    Next x

Next y

End Sub


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12426568.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-25
下一篇 2023-05-25

发表评论

登录后才能评论

评论列表(0条)

保存