How to tell when control loses focus

  • Thread starter Thread starter JezB
  • Start date Start date
J

JezB

I have a user control that I want to display slightly differently if it has
input focus. Trouble is, I can't see any event available (like FocusChanged)
to tell it when focus is gained and then lost again (upon which I want to
force repainting).

The same is true for any focusable Control (if I wanted to take any
particular action when it loses focus). What can I do ?
 
JezB said:
I have a user control that I want to display slightly differently if it has
input focus. Trouble is, I can't see any event available (like
FocusChanged) to tell it when focus is gained and then lost again (upon
which I want to force repainting).

Check out the controls' 'Enter', 'Leave', 'GotFocus', and 'LostFocus'
events.
 
JezB said:
What's the difference between Enter/Leave and GotFocus/LostFocus ?

Take a look at the documentation of 'LostFocus', for example, which contains
an overview of the order in which the events fire.
 
Back
Top