' 可以加上窗体点击事件和失去焦点设置成同一种颜色就达到想要的效果了
Private Sub Form_Click()
Text1.BackColor = vbGreen
End Sub
' 获得焦点文本框变红色
Private Sub Text1_GotFocus()
Text1.BackColor = vbRed
End Sub
' 失去焦点文本框变绿色
Private Sub Text1_LostFocus()
Text1.BackColor = vbGreen
End Sub
Private Sub Text1_GotFocus() '获得焦点
Text1.BackColor = vbRed
End Sub
Private Sub Text1_LostFocus() '失去焦点
Text1.BackColor = vbGreen
End Sub