The Lanham Factor
The (ir)rational thoughts of a (not-so)mad man

Invalidate, Update, Refresh, Oh My!

Friday, February 9, 2007 6:09 AM

So in the ongoing saga of the Lords of Kobol reminding me that those two people are right and that I'm not smart nor a good developer...there is a new kid in town.  The new kid is a spoiled brat who sits in the corner and, with bottom lip firmly out, repeats "I will not fire the Paint event!  I won't! I won't! I won't! And you can't make me!"

me - "What about if I call Invalidate?"

kid - "NOPE!"

me - "What if I call Invalidate (True) on the user control?"

kid - "Not even then."

me - "Okay...what if I call Update after calling Invalidate (in various forms)?  How about then?  Then will you fire the Paint event?"

kid - "Nunh Unh."

(I'm getting desparate...the root of which is despair)

me - "I know.  How about Refresh?  Surely if I call Refresh you'll be a nice kid and fire the Paint event."

kid - (laughing) "Silly old man...I won't fire that event even if  you call ALL THREE!  You can even try invalidating a particular region of a particular control, calling any of those three (or all) on individual controls, or any combination and permutation of calls to get the form to refresh...but I won't fire the paint event.  I won't!  I won't!  I won't!"

So maybe someone out there can explain to me why the Paint event won't fire and/or why the OnPaint method never gets called.




Feedback

# re: Invalidate, Update, Refresh, Oh My!

Are you overriding any methods and not calling base.SameMethod?

It's possible that the base method is the one that is calling OnPaint and if you override it and don't call the base method also OnPaint will never get called. 3/16/2007 9:53 PM | carlsonad

Post a comment