Mega Code Archive

 
Categories / Delphi / Forms
 

Cloning a form

Title: Cloning a form Question: How to clone a form? Answer: example://procedure TForm1.Button1Click(Sender: TObject); var mstream: TMemoryStream; novaForma: TForm1; begin mstream := TMemoryStream.Create; try mstream.WriteComponent(Form1); novaForma := TForm1.CreateNew(Application); mstream.Position := 0; mstream.ReadComponent(novaForma); { Note that it will appear exactly on top of the original! If you want, you can change tha position of new FORM} novaForma.Show; finally mstream.Free end; end;