我碰到这个问题: 我用了一个一个文本框放在上面了,很好用:) Private Sub Combo1_Click() If Combo1.Text = "1 as blue" Then Label1.ForeColor = vbBlue End If If Combo1.Text = "2 as black" Then Label1.ForeColor = vbWhite End If If Combo1.Text = "3 as yellow" Then Label1.ForeColor = vbYellow End If If Combo1.Text = "4 as green" Then Label1.ForeColor = vbGreen End If If Combo1.Text = "5 as red" Then Label1.ForeColor = vbRed End If
Text1.Text = Left(Combo1.Text, 1)If Text1.Text <> "" Then ss = Text1.TextEnd IfEnd Sub Private Sub Combo1_LostFocus() If ss <> "" Then Combo1.Text = ss MsgBox Combo1.Text End If End Sub Private Sub Form_Load() With Combo1 .AddItem "1 as blue" .AddItem "2 as black" .AddItem "3 as yellow" .AddItem "4 as green" .AddItem "5 as red" End With Text1.Locked = True Label1.Caption = "Hello" Label1.BackColor = vbBlack Combo1.Text = "" End Sub
combo.additem.纪录(i)
end if
我用了一个一个文本框放在上面了,很好用:)
Private Sub Combo1_Click()
If Combo1.Text = "1 as blue" Then
Label1.ForeColor = vbBlue
End If
If Combo1.Text = "2 as black" Then
Label1.ForeColor = vbWhite
End If
If Combo1.Text = "3 as yellow" Then
Label1.ForeColor = vbYellow
End If
If Combo1.Text = "4 as green" Then
Label1.ForeColor = vbGreen
End If
If Combo1.Text = "5 as red" Then
Label1.ForeColor = vbRed
End If
Text1.Text = Left(Combo1.Text, 1)If Text1.Text <> "" Then
ss = Text1.TextEnd IfEnd Sub
Private Sub Combo1_LostFocus()
If ss <> "" Then
Combo1.Text = ss
MsgBox Combo1.Text
End If
End Sub
Private Sub Form_Load()
With Combo1
.AddItem "1 as blue"
.AddItem "2 as black"
.AddItem "3 as yellow"
.AddItem "4 as green"
.AddItem "5 as red"
End With
Text1.Locked = True
Label1.Caption = "Hello"
Label1.BackColor = vbBlack
Combo1.Text = ""
End Sub