Immediate repainting of forms

My application draws mathematical patterns in child windows. The
parameters for the patterns come from DialogForm. When DialogForm
closes, the child windows already created need repainting. This is done
by blitting a copy of the finished pattern to the child window. However,
this takes place after the pattern has been drawn in the new child, and
as this drawing takes many seconds, the delay is annoying.
Why does not this code work? I would think that the repaint messages to
the child windows would be processed when ProsessMessages is
encountered, but evidently the last two lines are processed before the
repainting takes place.

procedure TMainForm.MenuClick(Sender: TObject);
    if MDIChildCount >0 then
       for i:= 0 to MDIChildCount-1  do

How can I achieve what I want?