Mega Code Archive

 
Categories / Delphi / Forms
 

How to open a form animated

Title: How to open a form animated procedure TForm1.Button1Click(Sender: TObject); procedure Delay(msec: Longint); var start, stop: Longint; begin start := GetTickCount; repeat stop := GetTickCount; Application.ProcessMessages; until (stop - start) = msec; end; var maxx, maxy: Integer; begin maxx := form2.Width; maxy := form2.Height; form2.Width := 112; form2.Height := 27; form2.Left := (Screen.Width - form2.Width) div 2; form2.Top := (Screen.Height - form2.Height) div 2; form2.Show; repeat if form2.Height + (maxy div 5) = maxy then form2.Height := maxy else form2.Height := form2.Height + (maxy div 5); if form2.Width + (maxx div 5) = maxx then form2.Width := maxx else form2.Width := form2.Width + (maxx div 5); form2.Left := (Screen.Width - form2.Width) div 2; form2.Top := (Screen.Height - form2.Height) div 2; delay(30); until (form2.Width = maxx) and (form2.Height = maxy); end;