Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6141113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:12:18+00:00 2026-05-23T18:12:18+00:00

I have an application that has 5 different sized frames. I’d like to dynamically

  • 0

I have an application that has 5 different sized frames. I’d like to dynamically re-size the main form to fit the frame when I move from one frame to another.

I can use the MinHeight/MinWidth properties of the frame to force the main form to fit the frame, but then when moving to a smaller frame, the main form does not adjust it’s size.

Any ideas?

–Edit

...
TFormMain = Class(TForm)
...
public
  FrameImportPackage: TFrameImportPackage;
...

procedure TFormMain.MenuPackagesImportClick(Sender: TObject);
begin
  if not (Assigned(FrameImportPackage)) then
    begin
      FrameImportPackage := TFrameImportPackage.Create(Self);
      FrameImportPackage.LabelFrameCaption.Caption := 'Import or Edit a Package';
    end
  else
    begin
      FrameImportPackage.BringToFront;
    end;

  FrameImportPackage.Parent := Self;
end;

–Edit

Regards, Pieter

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:12:19+00:00Added an answer on May 23, 2026 at 6:12 pm

    If I understand your question correctly, you’ve got frames that don’t change size, you want the form to update size to fit your frames. Let Delphi handle that for you, using the AutoSize property.

    Set AutoSize = True for your form.


    I’ve tested AutoSize with the following code, using Delphi 2010:

    • Create a new VCL application. On the blank form drop a single Panel, let it keep it’s name (Panel1). Make sure the panel is not too small, because we’ll write code to decrease it’s size at runtime.
    • Set the form’s AutoSize property to True.
    • Drop two buttons on the panel, Button1 and Button2.
    • Double click the buttons, and copy-paste the following event handlers:

    Code:

    procedure TForm31.Button1Click(Sender: TObject);
    var NewR: TRect;
    begin
      NewR := Panel1.BoundsRect;
      Dec(NewR.Right, 32);
      Dec(NewR.Bottom, 32);
    
      Button1.Parent := Self;
      Button2.Parent := Self;
    
      Panel1.Free;
      Panel1 := TPanel.Create(Self);
      Panel1.BoundsRect := NewR;
      Panel1.Parent := Self;
    
      Button1.Parent := Panel1;
      Button2.Parent := Panel1;
    end;
    
    procedure TForm31.Button2Click(Sender: TObject);
    begin
      Panel1.Height := Panel1.Height - 32;
      Panel1.Width := Panel1.Width - 32;
    end;
    

    This essentially gives you two ways of decreasing the size of the panel, to handle two possible scenarios: Button1 frees the old panel and creates a new, smaller panel. Button2 directly resize the existing panel. Both work as expected!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that has many different types of objects that each persist
We have an application that has to be flexible in how it displays it's
I have an application that has created a number of custom event log sources
I have an application that has Powershell 1 embedded into it, but we need
We have an application that has one or more text console windows that all
I have an application that has several objects (about 50 so far, but growing).
I have an application that has multiple states, with each state responding to input
I have an application that has to deal with getting special characters in its
I have an application that has a primary layout of portrait (it is fixed
Background: We have an application that has been in the works for over a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.