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...
LVL 5
paulb1989Asked:
Who is Participating?
 
mokuleCommented:
Hi,
You can put this image on a panel and this panel on top of You form
0
 
paulb1989Author Commented:
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;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.