Thanks Sean and Ross!

Your answers gave me some leads and I'm looking into them now.

Here's a site with a possible answer and code snippet.

http://www.delphi3000.com/articles/article_2225.asp?SK=

from that site:

"I have an application in which the user drags TImage descendants around 
on a
background image. When an image is dropped, I have to run through all 
the current images finding out where they are, and then arrange their 
z-order appropriately.
When I do this, there's significant flickering. I've tried calling
LockWindowUpdate(Handle) before the operation, then LockWindowUpdate(0) 
at the
end, but several repaint operations still seem to take place at once. 
I'd like
to be able to repaint the whole form once only, or failing that, limit 
the repaint to a specific area of the form (so that all my buttons etc, 
which aren't involved in any of this, don't have to flicker too).  "

Answer:

  var
    FLockFormUpdatePile : integer;
 
  procedure TForm1.LockFormUpdate;
  begin
    if FLockFormUpdatePile = 0 then
      Perform(WM_SetRedraw, 0, 0);
    inc(FLockFormUpdatePile);
  end;
 
  procedure TForm1.UnlockFormUpdate;
  begin
    dec(FLockFormUpdatePile);
    if FLockFormUpdatePile = 0 then begin
      Perform(WM_SetRedraw, 1, 0);
      RedrawWindow(Handle, nil, 0, RDW_FRAME + RDW_INVALIDATE +
        RDW_ALLCHILDREN + RDW_NOINTERNALPAINT);
    end;
  end;
Chuck Belanger
> Don't use LockWindowUpdate.  See 
> http://blogs.msdn.com/oldnewthing/archive/2007/02/21/1735472.aspx
>
>
> Regards
>
> Sean Cross
> Chief Information Officer
>   

_______________________________________________
Delphi mailing list -> Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to