Tracing Invalidate calls (Windows Forms)
-
I'm trying to do some performance enhancements to my project, and, I've discovered that frequently my animation (custom) control is getting painted twice for each distinct frame. I've traced all calls that I make to Invalidate(), but it seems that something else must be invalidating my control - for every Invalidate call that I make, there are always two calls to OnPaint. Problem is, Control.Invalidate is not marked virtual, so I cannot trap all calls to base Invalidates, which I suspect is what is causing the seemingly unneccessary Invalidates. Anyone know of a diagnostic technique that will allow me to establish why my control gets painted, for each call?
using System.Beer;
-
I'm trying to do some performance enhancements to my project, and, I've discovered that frequently my animation (custom) control is getting painted twice for each distinct frame. I've traced all calls that I make to Invalidate(), but it seems that something else must be invalidating my control - for every Invalidate call that I make, there are always two calls to OnPaint. Problem is, Control.Invalidate is not marked virtual, so I cannot trap all calls to base Invalidates, which I suspect is what is causing the seemingly unneccessary Invalidates. Anyone know of a diagnostic technique that will allow me to establish why my control gets painted, for each call?
using System.Beer;
Can't you trap the calls from the overriden OnPaint() method? Or by overriding OnInvalidated()?
-
I'm trying to do some performance enhancements to my project, and, I've discovered that frequently my animation (custom) control is getting painted twice for each distinct frame. I've traced all calls that I make to Invalidate(), but it seems that something else must be invalidating my control - for every Invalidate call that I make, there are always two calls to OnPaint. Problem is, Control.Invalidate is not marked virtual, so I cannot trap all calls to base Invalidates, which I suspect is what is causing the seemingly unneccessary Invalidates. Anyone know of a diagnostic technique that will allow me to establish why my control gets painted, for each call?
using System.Beer;
-
OnInvalidate()
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008)Thanks both, I'd not seen that event before. This has shed a bit more light on the matter: my control is only getting invalidated once. However, OnPaint is called twice - any idea why?
using System.Beer;