Mega Code Archive

 
Categories / Delphi / Forms
 

Make a child form without mdi

uses Unit2; { 2. Form } procedure TForm1.Button1Click(Sender: TObject); begin { CreateParented creates and initializes a control as the child of a specified (non-VCL) container. Die Methode CreateParented erzeugt und initialisiert ein Steuerelement als untergeordnetes Objekt des angegebenen (Nicht-VCL-) Fensters. } Form2 := TForm2.CreateParented(Form1.Handle); // show Form2 Form2.Show; // make Form2 active SendMessage(Form2.Handle, WM_NCACTIVATE, Ord(True), 0); end; procedure TForm1.FormDestroy(Sender: TObject); begin Form2.Close; end;