11315.html

来自「以电子书的形式收集了VB一些常见问题解决方法,可以很方便的查找自己需要解决的问题」· HTML 代码 · 共 23 行

HTML
23
字号
<html>
  <head>
    <title>Re: 如何更改label物件的颜色</title>
  </head>
  <body bgcolor="#FFFFFF" vlink="#808080">
    <center>
      <h1>Re: 如何更改label物件的颜色</h1>
    </center>
<hr size=7 width=75%>

<hr size=7 width=75%><p>
Posted by <a href="mailto:harlem73@ms26.hinet.net">哈林</a> on March 24, 1999 at 14:13:29:<p>
In Reply to: <a href="11311.html">如何更改label物件的颜色</a> posted by boo on March 24, 1999 at 11:50:01:<p>
请测试...<br>表单上须有Label物件阵列五个(0~4)<br>:Dim i<br>:Dim rndColor<br>:Const c1 = &HFF0000<br>:Const c2 = &HFF&<br>:Const c3 = &HFFFF&<br>:Const c4 = &HC000&<br>:Const c5 = &H80FF&<br>:<br>:Private Sub Form_Click()<br>:For i = 0 To Label1.UBound<br>:    Randomize<br>:    rndColor = Int((Label1.UBound + 1) * Rnd + 1)<br>:    Select Case rndColor<br>:           Case 1<br>:                Label1(i).BackColor = c1<br>:           Case 2<br>:                Label1(i).BackColor = c2<br>:           Case 3<br>:                Label1(i).BackColor = c3<br>:           Case 4<br>:                Label1(i).BackColor = c4<br>:           Case 5<br>:                Label1(i).BackColor = c5<br>:    End Select<br>:Next i<br>:End Sub<p>: 如何利用回圈一次更改多个label的颜色<p>
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 11315-->
</ul><!--end: 11315-->
<br><hr size=7 width=75%><p>

</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?