请教:想使点击按钮后,很多白色的圆点慢慢地从窗体的底部向上移动,用vb怎样实现?
Dimsp()AsShape,i%PrivateSubCommand1_Click()Me.Timer1.Enabled=TrueEndSubPrivateSubForm...
Dim sp() As Shape, i%
Private Sub Command1_Click()
Me.Timer1.Enabled = True
End Sub
Private Sub Form_Load()
me.Timer1.interval=200
Me.Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
ReDim sp(1 To 1000)
i = i + 1
Set sp(i) = Controls.Add("vb.shape", "sh" & i)
With sp(i)
.BackColor = vbWhite
.BackStyle = 1
.BorderColor = vbWhite
.BorderStyle = 1
.Shape = 3
.Visible = True
.Left = Rnd * Me.ScaleWidth
.Width = Rnd * 500
End With
sp(i).Top = sp(i).Top + 500
End Sub 展开
Private Sub Command1_Click()
Me.Timer1.Enabled = True
End Sub
Private Sub Form_Load()
me.Timer1.interval=200
Me.Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
ReDim sp(1 To 1000)
i = i + 1
Set sp(i) = Controls.Add("vb.shape", "sh" & i)
With sp(i)
.BackColor = vbWhite
.BackStyle = 1
.BorderColor = vbWhite
.BorderStyle = 1
.Shape = 3
.Visible = True
.Left = Rnd * Me.ScaleWidth
.Width = Rnd * 500
End With
sp(i).Top = sp(i).Top + 500
End Sub 展开
展开全部
很多白色的圆点慢慢地从窗体的底部向上移动,到顶端消失:
Dim sp(1000) As Shape, i%
Private Sub Command1_Click()
Me.Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Me.Timer1.Interval = 200
Me.Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
If i < 1000 Then
Set sp(i) = Controls.Add("vb.shape", "sh" & i)
With sp(i)
.BackColor = vbWhite
.BackStyle = 1
.BorderColor = vbWhite
.BorderStyle = 1
.Shape = 3
.Visible = True
.Left = Rnd * Me.ScaleWidth
.Width = Rnd * 500
.Top = Rnd * Me.ScaleHeight
End With
i = i + 1
For j = 0 To i - 1
If sp(j).Top + sp(j).Height > 0 Then sp(j).Top = sp(j).Top - 100
Next
End If
End Sub
Dim sp(1000) As Shape, i%
Private Sub Command1_Click()
Me.Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Me.Timer1.Interval = 200
Me.Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
If i < 1000 Then
Set sp(i) = Controls.Add("vb.shape", "sh" & i)
With sp(i)
.BackColor = vbWhite
.BackStyle = 1
.BorderColor = vbWhite
.BorderStyle = 1
.Shape = 3
.Visible = True
.Left = Rnd * Me.ScaleWidth
.Width = Rnd * 500
.Top = Rnd * Me.ScaleHeight
End With
i = i + 1
For j = 0 To i - 1
If sp(j).Top + sp(j).Height > 0 Then sp(j).Top = sp(j).Top - 100
Next
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询