Link to home
Start Free TrialLog in
Avatar of paulb1989
paulb1989

asked on

Paint Above Controls

In my project I am trying to do a kind of transition effect. It goes like this:

1) Some controls are visible on the form
2) I capture an image of the form into a TBitmap
4) A timer paints the image onto the forms canvas every 10 milliseconds, making it slightly smaller each time (revealing more of the new contents of the form)
3) New controls are shown
4) The timer stops painting the image after it has done it 100 times

This works fine except for 2 things:

1) The form flickers a LOT. I have set the forms DoubleBuffered property to true but still it flickers...
2) The image is only painted above descendants of TGraphicControl. Other controls are still visible...

I need a way to solve both of these problems...
Avatar of paulb1989
paulb1989

ASKER

Here is the code for the timer that paints on the form:

procedure TfrmDesign.TransTimerTimer(Sender: TObject);
begin
  Inc(Steps);

  if Steps <= TransSteps then
  begin
    TransTimer.Enabled := False;

    Invalidate;
    Application.ProcessMessages;
    Canvas.CopyRect(Rect(0, 0, ClientWidth, ClientHeight - (Steps * (ClientHeight div TransSteps))), Pic.Canvas, ClientRect);

    TransTimer.Enabled := True;
  end else
  begin
    if Assigned(Pic) then
      Pic.Free;
    Invalidate;
    TransTimer.Enabled := False;
  end;
end;
ASKER CERTIFIED SOLUTION
Avatar of mokule
mokule
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial