views:

295

answers:

1

I'm trying to implement some animation using winforms and gdi+, but I get a lot of tearing moving sprites inside a control.

Is there a way in managed .net to have the overriden Control.OnPaint method wait for the vertical retrace of the monitor?

+1  A: 

Are you already using double buffering? If not I would suspect that would remove the tearing, and it is simpler than trying to wait for the vertical retrace.

Logan Capaldo
Yes, already using double buffer.
David Suarez
Double buffering doesn't prevent tearing. See en.wikipedia.org/wiki/Page_tearing. Wait vsync is the only solution I know of in a Windows application. Unfortunately the only way I've found to do this involves Direct3D. Downloading a 500mb+ SDK just for one function seems a bit silly.
Andrew Bainbridge
That's what I've found so far too. I guess GDI wasn't designed for animation.
David Suarez