OnBackColorChanged not being called

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

Hi,



I have a custom user control that needs to be notified every time the
BackColor of its parent is altered. Using OnBackColorChanged within my
custom control only seems to work if my control's BackColor has not been set
to anything. I suspect being an ambient property derived from its parent, it
will be notified as long as it's still getting its property value from the
parent, that is, until you explicitly set the BackColor to some value other
than Color.Empty.



Other than attaching to the Parent.BackColorChanged event chain, is there
any other way of being notified of a BackColor change within the parent
control?



Reason is that I'm painting my custom control in combination with the
parent's BackColor property and I need to invalidate my control anytime the
parent control gets repainted.



Thanks in advance,

Tony.
 
Guys,



Please ignore this. I accidentally stumbled across OnParentBackColorChanged
and it does exactly what I want. And I thought I had exhausted all levels of
reference prior to posting here...

1. MSDN

2. Google

3. Forums

4. Books

5. Favourite dev/source sites

6. Work colleagues



....when out of the blue, intellisence revealed all. Wow, how was I ever
coding without it in the past.



Till next time, ciao.
 
Back
Top