0

i'm trying to dynamically show a form in a TPanel using this function

procedure Show_form_in_panel(form: TForm; Panel: Tpanel);
begin
  form.Parent := Panel;
  form.Show;   
  form.WindowState := wsMaximized;
end; 

the form is showing very normal but he's not maximized in my panel and also i want to make this form automaticly react like components that have the Alight property = (alClient)

6
  • 1
    Have you tried using alClient? That's how I do it. Commented Sep 12, 2015 at 12:35
  • Showing a TForm inside a TPanel sounds unusrual to me. Is this supposed to work? Have you considered using a TFrame instead of a TForm? Commented Sep 12, 2015 at 12:37
  • @Wosi It's perfectly normal practice. Commented Sep 12, 2015 at 12:38
  • @JerryDodge Thanks. I read for the first time that someone wants to show a form in a panel. In the projects I have worked on there have always been TFrames for sharing the same piece of UI over different places. Is there any advantage of using a form in a panel? Commented Sep 12, 2015 at 12:42
  • 2
    @Wosi One big advantage of doing this is for example docking or undocking - or a form which might also be used elsewhere on its own. After all, a form is just another control, and other win controls are also just other windows. You can pop-out a panel or other controls and treat them as bordered forms also. Commented Sep 12, 2015 at 12:44

1 Answer 1

4

I want to make this form automatically react like components that have the Align property set to alClient.

That's the solution. Remove

form.WindowState := wsMaximized;

and replace with

form.Align := alClient;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.