我想创建一个处理程序,它在使用 VB6 时为所有人侦听GetFocus
/事件,我该如何实现?LostFocus
TextBoxes
Form
到目前为止我尝试了什么:
Option Explicit
Dim Cnt As Control
Private WithEvents Txt As VB.TextBox
Private Sub Form_Load()
For Each Cnt In Me.Controls
If TypeOf Cnt Is TextBox Then
Set Txt = Cnt
End If
Next Cnt
End Sub
Private Sub Txt_GotFocus()
Txt.BackColor = &H80000018
End Sub
Private Sub Txt_LostFocus()
Txt.BackColor = &H80000005
End Sub
但这仅适用TextBox
于Form