procedure TForm1.Button2Click(Sender: TObject); var I, J, X, Y: Word; begin I := 0; J := 0; while I < 64000 do begin Randomize; while J < 64000 do begin Y := Random(J); Inc(J); Application.ProcessMessages; //处理事件 end; X := Random(I); Inc(I); end; Canvas.TextOut(10, 10, 'The Button2Click handler is finished'); end;