# Re: 如何更改label物件的颜色

Posted by 哈林 on March 24, 1999 at 14:13:29:

In Reply to: 如何更改label物件的颜色 posted by boo on March 24, 1999 at 11:50:01:

请测试...
表单上须有Label物件阵列五个(0~4)
:Dim i
:Dim rndColor
:Const c1 = &HFF0000
:Const c2 = &HFF&
:Const c3 = &HFFFF&
:Const c4 = &HC000&
:Const c5 = &H80FF&
:
:Private Sub Form_Click()
:For i = 0 To Label1.UBound
: Randomize
: rndColor = Int((Label1.UBound + 1) * Rnd + 1)
: Select Case rndColor
: Case 1
: Label1(i).BackColor = c1
: Case 2
: Label1(i).BackColor = c2
: Case 3
: Label1(i).BackColor = c3
: Case 4
: Label1(i).BackColor = c4
: Case 5
: Label1(i).BackColor = c5
: End Select
:Next i
:End Sub

: 如何利用回圈一次更改多个label的颜色

Follow Ups: