vb中一个shape控件,一个timer控件,如何根据时间的变化改变颜色,例如5s的时候红色,
2个回答
展开全部
Private Sub Form_Load()
Shape1.BackStyle = 1
Shape1.BackColor = vbGreen
End Sub
Private Sub Timer1_Timer()
Static n%
If n = 5 Then
Shape1.BackColor = vbRed
Else
Shape1.BackColor = vbGreen
End If
n = n + 1
If n = 6 Then n = 0
End Sub
Shape1.BackStyle = 1
Shape1.BackColor = vbGreen
End Sub
Private Sub Timer1_Timer()
Static n%
If n = 5 Then
Shape1.BackColor = vbRed
Else
Shape1.BackColor = vbGreen
End If
n = n + 1
If n = 6 Then n = 0
End Sub
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询