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

  • SEARCH
  • Home
  • 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 6081915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:13:48+00:00 2026-05-23T11:13:48+00:00

How can I set the width and height of a form in Delphi 7?

  • 0

How can I set the width and height of a form in Delphi 7? The form contains different types of controls on it. I need to set the main form size to 127×263. It should change programmatically
in a button click.

  • 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-23T11:13:48+00:00Added an answer on May 23, 2026 at 11:13 am

    Like so:

    MainForm.Width := 127;
    MainForm.Height := 263;
    

    Or perhaps you want to set the client area to those dimensions:

    MainForm.ClientWidth := 127;
    MainForm.ClientHeight := 263;
    

    Of course, you most commonly set these properties in the Object Inspector at design time and then they are written to your form’s .dfm file.

    If you want such a change to occur on a button click add a handler for the button click that looks like this:

    procedure TMainForm.Button1Click(Sender: TObject);
    begin
      Width := 127;
      Height := 263;
    end;
    

    In this last excerpt you don’t need to specify the MainForm object instance because the event handler is a member of the TMainForm class and so the Self is implicit.

    If you wish to follow Ulrich Gerhardt’s advice (see comment) and use SetBounds then you would write:

    SetBounds(Left, Top, 127, 263);
    

    Finally, if your form has Scaled = True then you need to deal with font scaling. Hard coded pixel dimensions like this will not be appropriate for machines with font scaling set to a different value from your machine.

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

Sidebar

Related Questions

How can the width of the textbox rendered by the @FileUpload helper be set?
int width, height; width = this.Size.Width; height = this.Size.Height; width /= 3; height /=
I have form that has a restricted size and the overflow style set to
How can I get the size a form would have in Maximized windowstate without
I need a form that inludes a list of related available options that can
With mx:Box I can set the direction to be either horizontal or vertical. I'd
With jQuery UI you can set icons from the framework on button, i want
I know I can set a CultureInfo object with an specified culture in the
Normally with Java Swing you can set the background color of a button with:
Currently I can set ringtones and notifications with: byte[] buffer = null; InputStream fIn

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.