在Visual Studio中高亮显示组合框/文本框时,如何更改标签的颜色



当用户要在输入框上输入文本或在组合框上选择项目时,我正试图突出显示/更改标签的颜色。我试过这样做:

if combobox1.Focus() then
label.Forecolor = Color.White
End if

我原以为会这么简单,但没用。任何人

使用适当的事件。请注意,ForeColor仅更改标签中文本的颜色。

Private Sub cboSheets_Enter(sender As Object, e As EventArgs) Handles cboSheets.Enter
Label1.ForeColor = Color.White
End Sub
Private Sub TextBox1_Enter(sender As Object, e As EventArgs) Handles TextBox1.Enter
Label1.ForeColor = Color.White
End Sub

最新更新