I opened a Form within a Panel

3

Seeing a question here in the Stackoverflw where one answer was to open Form within a Tpanel .

Is it possible to open Form within Tpanel ? And if positive how do I open a Form within a Tpanel ?

    
asked by anonymous 05.04.2018 / 13:43

2 answers

4

You can also use this format:

var
  vForm : TForm;
begin
  vForm        := TForm.Create(MeuPainel);
  vForm.Parent := MeuPainel;
  vForm.Left   := 0;
  vForm.Top    := 0;
  vForm.Height := MeuPainel.Height;
  vForm.Width  := MeuPainel.Width;
  vForm.Show;

One difference is that it was possible to move the Form (load it on the screen);

It's still worth remembering that you need a Memory control for this.

    
06.04.2018 / 16:36
2

Yes you can. Just indicate that the parent of your Form is the panel you want. Something like

//Criar nova instancia do form e mostrar num painel
f:=TFrmMeuForm.Create();
f.BorderStyle:=bsNone;
f.Align:=alClient;
f.Parent:=MeuPainel;
f.Visible:=true;
    
05.04.2018 / 13:50