VB高手请进,高分
- 提问者网友:星軌
- 2021-07-25 22:22
- 五星知识达人网友:拾荒鲤
- 2021-07-25 23:38
添加一个Timer
加入以下代码
Private Sub Form_Load()
Me.ScaleMode = 3
Me.AutoRedraw = True
Timer1.Interval = 100
End Sub
Static Sub Paint()
Const PI = 3.14169265
Dim X As Single
Dim Y As Single
Dim R As Single
Dim x1 As Single
Dim y1 As Single
Randomize
If R < 100 Then R = R + 2 Else Timer1.Enabled = False
If X = 0 Then X = Rnd * Me.ScaleWidth: Y = Rnd * Me.ScaleHeight
For I = 0 To 359
x1 = R * Cos(I / PI) + X
y1 = R * Sin(I / PI) + Y
PSet (x1, y1), RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Next I
End Sub
Private Sub Timer1_Timer()
Paint
End Sub
- 1楼网友:梦中风几里
- 2021-07-26 01:07
加个timer控件,在里面写:
Private Sub Timer1_Timer() Dim M As String Dim X0, Y0, I As Integer ScaleMode = 0 FontSize = 24 Me.ForeColor = QBColor(Rnd * 15) M = "新年快乐!" Cls CurrentX = Form1.Width / 2 - TextWidth(M) / 2 CurrentY = Form1.Height / 2 - TextHeight(M) Print M For I = 1 To 100 DrawWidth = (DrawWidth + 1) Mod 10 + 1 X0 = ScaleHeight * 2 * Rnd Y0 = ScaleWidth * 2 * Rnd ' PSet (X0, Y0), QBColor(Rnd * 15) PSet (X0, Y0), RGB(Rnd * 255, Rnd * 255, Rnd * 255) Next I End Sub 一个雪花飘落的感觉。