Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How can I code a resizeble form ?

Posted on 1998-12-02
10
Medium Priority
?
155 Views
Last Modified: 2012-05-04
I'd like to have a resizeble form with all of its buttons and listview.
What code I need to add to my form ?
(I'd like to know shortest way to do it)
Thanks.
0
Comment
Question by:borgo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 80 total points
ID: 1349000
Hi Borgo,

If I understood your question right then this is probably what you're looking for.

I've used this technique for some years, it comes from a delphi book "Delphi How-to".



procedure TResizer.FormCreate(Sender: TObject);
begin
  BH := Height;
  BW := Width;
end;

procedure TResizer.FormResize(Sender: TObject);
var
  AH, AW: Word;
  R: TRect;
  I: Integer;
begin
  AH := Height;
  AW := Width;
  for I := 0 to ComponentCount - 1 do
  if Components[I] is TControl then
  begin
    R := TControl(Components[I]).BoundsRect;
    R.Left := MulDiv(R.Left, AW, BW);
    R.Top := MulDiv(R.Top, AH, BH);
    R.Right := MulDiv(R.Right, AW, BW);
    R.Bottom := MulDiv(R.Bottom, AH, BH);
    TControl(Components[I]).BoundsRect := R;
  end;
  BH := Height;
  BW := Width;
end;

Hope this helps.
Good luck
Bruintje

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1349001
I have a componenta that might helpp
0
 
LVL 3

Expert Comment

by:bryan7
ID: 1349002
I have a panel that resizes all the components on it when it's resized.

bryan
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 10

Expert Comment

by:viktornet
ID: 1349003
borgo. Did the component I sent you worked?? If yes, I'd appreciate to get the credit.. If not then let someone have it..

Cheers,
Viktor
0
 

Author Comment

by:borgo
ID: 1349004
Bryan 7:  Please send me you panel ? Is it free and with source ? I'll use it in the application which  I'll do for my next exam.

Viktornet: I haven't tried your component yet. I'll inform you early. Thanks again.

Bruintje: Yes it works. But is not a too simple solution ? What do you think about ? Thank you.


0
 
LVL 44

Expert Comment

by:bruintje
ID: 1349005
Hi Borgo,

It is a short way in the KISS way.

Bruintje.
0
 

Author Comment

by:borgo
ID: 1349006
Bruintje:
What is KISS way ? :-)
You'll get your points.
Thank you for your answer.
It will be very usefull to me.
0
 
LVL 44

Expert Comment

by:bruintje
ID: 1349007
Hi Borgo,

Hum.. "Keep It Simple Stupid".
Learned the hard way that doing things simple is a way of keeping up in real life. If you have done that long enough you can buy yourself the time to create more beautiful(complex) things, making life worth living.

Bruintje.


0
 
LVL 44

Expert Comment

by:bruintje
ID: 1349008
Hi again,

In addition to my previous comment, I think you should use the solution that's most suitable for the needs. If you had to make only some components resizing at a given action (couldn't think of an example, maybe zooming? :) )then it would be simpler to use a component that turns on or off the resizing capabillities of selected components.
0
 

Author Comment

by:borgo
ID: 1349009
You're right. :-)

Thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question