ExtenderProvider invalidated event problems...
Posted on 2007-07-22
I have a component class that adds several provider extensions to a form and one of them is a Required property along with a Required color property and a Satisfied color property. I add a xxxChanged event handler that checks to see if the control's text is empty and if it is, I set the backcolor of that field to the Required color and if it is not empty, then I set it to the Satisified color. I was having trouble before with trying to get the control (textbox, combobox, etc.) painted initially until I started handling the Invalidated event. This worked fine for the textbox, combobox but failed for the NumericUpDown control. It fails with an infinite loop where the invalidated event triggers the text changed event triggering the invalidated event, ad nauseum. So, then I thought that perhaps I might trap the Paint event of the container that contains the control I'm extending, but I've not been too successful with this approach. Is there an event I can trap for a control when it is first displayed on a screen so that I can set its initial backcolor correctly depending on if it is empty or not?