Mega Code Archive

 
Categories / Delphi / Forms
 

Clone a Form

Title: clone a Form? procedure TForm1.Button1Click(Sender: TObject); var ms: TMemoryStream; newform: TForm1; begin ms := TMemoryStream.Create; try ms.WriteComponent(Form1); newform := TForm1.CreateNew(Application); ms.Position := 0; ms.ReadComponent(newform); { show the new form. Note that it will appear exactly on top of the original! You may want to change its Left and Top property to move it a bit. Zeigt die neue Form. Die neue Form erscheint genau oberhalb der original form. Die Left, Top Properties müssen evtl. noch angepasst werden } newform.Show; finally ms.Free end; end;