1

Hoping some of you out there will be able to point me in the right direction to handle flickering/tearing/redrawing issues when I 'animate' some components in an application.

I have to preface this by saying that the 'animations' seem to work correctly (no flickering etc) when not in full screen mode - i.e. 1024*768, borderstyle=bsSingle. It's when the application takes over the full monitor and the borderstyle becomes bsNone, that this issue becomes more than apparent.

There are 2 'animations':

1 - Panels scrolling left to right using the Winapi AnimateWindow method

2 - TmsAdvPolyPager stepping through each one of its items and subsequently showing its 'page'

When scrolling the panels, the panel that is 'exiting' leaves a 'trail' and the animation seems to shudder, it's no longer smooth.

When stepping through the TmsAdvPolyPager items, the next item will sometimes not become highlighted and the page it shows often has 'residuals' from the previous panel.

Both animations are triggered by a timer - the AnimateWindow is in it's own thread, the PolyPager stepping is not.

So, basically - any thoughts on how to smooth out these animations and force a correct redrawing of the TmsAdvPolyPager component? First time trying this kind of stuff, so not totally sure what to look into it.

As always, help is much appreciated!

ConBran
  • 369
  • 2
  • 15
  • Have you tried setting YourForm.DoubleBuffered to True? – GolezTrol Dec 14 '12 at 14:21
  • 4
    You should **never** do animations by moving windows (or, for that matter, any controls)! Paint the window manually using GDI instead! Some semi-relevant example: http://stackoverflow.com/questions/7223678/delphi-moving-overlapping-tshapes – Andreas Rejbrand Dec 14 '12 at 14:21
  • 2
    I don't understand why people insist on believing that `TForm.DoubleBuffered` is good. – David Heffernan Dec 14 '12 at 15:35
  • 2
    Is this in a VM (which one? The current VMWare Player has screen refresh issues) or 'just' on a host machine? – Jan Doggen Dec 14 '12 at 16:33
  • 1
    @JanDoggen turns out moving it off of VMWorkstation and onto an ACTUAL machine resolved the majority of the issues! – ConBran Dec 14 '12 at 19:44

1 Answers1

3

TPaintBox is what you need, possibly on a TScroller.

Dump the Panels and draw to rectangles on the TPaintbox canvas.

You have obviously written 99% of this code already so moving to defined rectangles shouldn't be a problem :)

Despatcher
  • 1,745
  • 12
  • 18
  • Or, create your own custom control, if appropriate, then draw to its canvas. However easier said than done. – Jerry Dodge Dec 14 '12 at 18:03
  • Although running it on an actual machine solved the main issues, I'm still going to give this a whirl and see what I can do with it! Thanks! – ConBran Dec 14 '12 at 19:46