Minh Tiên > 05-09-17, 11:58 AM
tranthanhan1962 > 05-09-17, 01:51 PM
ongke0711 > 05-09-17, 02:19 PM
Minh Tiên > 05-09-17, 04:38 PM
(05-09-17, 01:51 PM)tranthanhan1962 Đã viết: Có phải bạn muốn đổi màu control khi control nào được GotFocus và trở về màu bình thường khi mất focus?
Public Function Focus(ByRef frm As Form)
   Dim Ctl As Control
   For Each Ctl In frm
       If InStr(1, Ctl.Tag, "Focus") > 0 Then
           If TypeOf Ctl Is CommandButton Or TypeOf Ctl Is TextBox Or TypeOf Ctl Is ComboBox Then
               Ctl.OnGotFocus = "=HandleFocus([" & Ctl.Name & "], True)"
               Ctl.OnLostFocus = "=HandleFocus([" & Ctl.Name & "], False)"
           End If
       End If
   Next
   
End Function