Versions des environnements
>Hi all, I have a form with a TableLayoutPanel occupying one half of the form, the panel contains lots of custom usercontrols, within the user controls I hook up some events which change the appearance of the control when it is selected or loses focus ( I change their back colour to red when they have focus and reset it to default when they don't) all works as expected while the panel / user control has focus, however if I click on a control outside of the panel the events still fire - which is not what I want as I want the user to know which control in the panel has focus ( the user controls are datagrids containg sets of interest rates ) I hope this makes sense ! so my question is , how can I restrict the events so they only fire when the panel has focus ?
Haven't worked with WinForms for some time but I think that when a user control loses focus you could check whether focus is still on a control in the containing panel (Control.ContainsFocus property). If true then reset to default, if not then leave the child control red....
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement