I opened a Form inside a Panel

Asked

Viewed 732 times

3

Seeing a Question here on Stackoverflw where one of the answers was to open the Form within a Tpanel.

It is possible to open a Form within a Tpanel? And if positive as one does to open a Form Within a Tpanel?

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;

A differential is that there is the possibility to move the Form (load it on the screen);

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

2

Yes you can. Just indicate that your Form’s Parent 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;
  • That’s cool, I’ll do tests with it. ...

  • 2

    Tfrmmeuform.Create(); will not generate a creation error?

  • It was an example of a form of mine that has a constructor like this.. typically takes the Owner as input parameter, that’s what refers?

  • In fact it necessarily needs an Owner, whether it exists (created) or not. It comes from the Class TForm.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.