关于一个VB程序设计
程序界面如上图所示:一个标签(名称为Label1),三个复选框(名称分别为Check1、Check2和Check3,Caption属性分别为红、绿和蓝)一个命令按钮(名称为Command1,Caption属性为结束),完成程序功能的代码如下:
Dim red As Integer
Dim green As Integer
Dim blue As Integer
Private Sub Check1_Click()
If Check1.Value = 1 Then
red = 255
Else
red = 0
End If
Label1.BackColor = RGB(red, green, blue)
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
green = 255
Else
green = 0
End If
Label1.BackColor = RGB(red, green, blue)
End Sub
Private Sub Check3_Click()
If Check3.Value = 1 Then
blue = 255
Else
blue = 0
End If
Label1.BackColor = RGB(red, green, blue)
End Sub
Private Sub Command1_Click()
End
End Sub
Private Sub Form_Load()
red = 0
green = 0
blue = 0
Label1.BackColor = RGB(red, green, blue)
End Sub