’命令按钮的名称为Command1
Private Sub Command1_Click()
Randomize Timer
BackColor = RGB(Rnd * 256, Rnd * 256, Rnd * 256)
End Sub
Private Sub Command1_Click()
Me.BackColor = &H4080& '或其他代表颜色的数值
End Sub
Private Sub Command1_Click()
Form1.BackColor = Int(Rnd() * 100000)
End Sub
比如蓝色窗体:me.backcolor=vb.blue
Private Sub Form_Click()
Form1.BackColor = &H0&
End Sub