I.T. Discussion Community!
-Collapse +Expand
Delphi
Search Delphi Group:

Advanced
-Collapse +Expand Delphi To/From
To/FromCODEGuides
-Collapse +Expand Delphi Store
PRESTWOODSTORE

Prestwood eMagazine

September Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyPascal and Delphi Coding BoardDelphi Object PASCAL Topic   Print This     

Resize form & all contained objects

Resize form & all contained objects in Delphi Object PASCAL topic (part of our Pascal and Delphi Coding group).

Quick Search: contained   objects   Resize form   Resize form &   all contained  
ronando
Italy
Hi, I'm tring to convert some forms from PARADOX to DELPHI.
i need to maximize from adn consequently all objects. In paradox i use bestfit instruction.

So can anyone give me a suggestion? I am rookie in Delphi.

Thanks
Fernando
 Posted 15 years ago (Thread Starter)
Comment Quote
About ronando -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #10805, 1 replies
Thread Started 11/2/2004 9:00:00 AM
View Counter=4016
Location=Italy  
Joined=17 years ago   MB Posts=50  
Most Recent Post
William Pantoja
Woodinville, WA, USA
There are many ways this can be accomplished:

1. Use the Anchors and Align properties on each component as appropriate to automatically have components resize.

2. Programmatically resize all components.

3. A hybrid of 1 and 2.

Obviously, the first way is the easiest and in most cases will work very well. In some cases, however, the automatic resizing does not give you the effect you need or due to other issues requires you to manually resize and place components.

I will only discuss the first option as the second and third are really beyond the scope of this forum and best handled on a case-by-case basis.

Using the Align and Anchors properties, you can affix your component to the edge of a form or a specific location on the form. Controls will stretch as appropriate when the form is resized. I have attached excerpts from teh VCL reference below:

From the VCL Help on the Align property (TControl):

"Use Align to align a control to the top, bottom, left, or right of a form or panel and have it remain there even if the size of the form, panel, or component that contains the control changes. When the parent is resized, an aligned control also resizes so that it continues to span the top, bottom, left, or right edge of the parent.

For example, to use a panel component with various controls on it as a tool palette, change the panelÆs Align value to alLeft. The value of alLeft for the Align property of the panel guarantees that the tool palette remains on the left side of the form and always equals the client height of the form.

The default value of Align is alNone, which means a control remains where it is positioned on a form or panel.

Tip: If Align is set to alClient, the control fills the entire client area so that it is impossible to select the parent form by clicking on it. In this case, select the parent by selecting the control on the form and pressing Esc, or by using the Object Inspector.

Any number of child components within a single parent can have the same Align value, in which case they stack up along the edge of the parent. The child controls stack up in z-order. To adjust the order in which the controls stack up, drag the controls into their desired positions.

Note: To cause a control to maintain a specified relationship with an edge of its parent, but not necessarily lie along one edge of the parent, use the Anchors property instead."

From the VCL Help on the Anchors property (TControl):

"Use Anchors to ensure that a control maintains its current position relative to an edge of its parent, even if the parent is resized. When its parent is resized, the control holds its position relative to the edges to which it is anchored.

If a control is anchored to opposite edges of its parent, the control stretches when its parent is resized. For example, if a control has its Anchors property set to [akLeft, akRight], the control stretches when the width of its parent changes.

Anchors is enforced only when the parent is resized. Thus, for example, if a control is anchored to opposite edges of a form at design time and the form is created in a maximized state, the control is not stretched because the form is not resized after the control is created.

Note: If a control should maintain contact with three edges of its parent (hugging one side of the parent and stretching the length of that side), use the Align property instead. Unlike Anchors, Align allows controls to adjust to changes in the size of other aligned sibling controls as well as changes to the parentÆs size."

---
William Pantoja

Consultant/Software Engineer
ForceOne Technologies, Inc.

 Posted 15 years ago
Comment Quote
About William Pantoja -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #10806 (Level 1.1)  Reply to 10805
Thread Started 11/2/2004 9:16:00 AM
View Counter=2
Location=Woodinville, WA, USA  
Joined=18 years ago   MB Posts=163   KB Posts=1  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1173A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #10805 Counter
4016
Since 4/2/2008

Follow PrestwoodBoards on: 


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech