Delphi and Kylix

Moderators: pritaeas
Number of threads: 7264
Number of posts: 19073

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Put an object in the middle of the form Posted by porodoro on 3 Jan 2006 at 7:07 AM
This message was edited by porodoro at 2006-1-3 7:9:28

This message was edited by porodoro at 2006-1-3 7:8:50

I've tryed this :

Panel1.top := (form1.Height - form1.height) + panel1.height div panel1.Height+form1.top;
panel1.left := (form1.width - form1.width) +form1.width div panel1.width ;


but it doesnt seem to work in all cases..




Report
Re: Put an object in the middle of the form Posted by zibadian on 3 Jan 2006 at 8:18 AM
: This message was edited by porodoro at 2006-1-3 7:9:28

: This message was edited by porodoro at 2006-1-3 7:8:50

: I've tryed this :
:
: Panel1.top := (form1.Height - form1.height) + panel1.height div panel1.Height+form1.top;
: panel1.left := (form1.width - form1.width) +form1.width div panel1.width ;
:
:
: but it doesnt seem to work in all cases..
:
:
:
:
:
The formula for the middle is:
  Panel1.Left := (Form1.ClientWidth div 2) - (Panel1.Width div 2);

Your formula is this:
  panel1.left := 0+form1.width div panel1.width;

since Form1.Width - Form1.Width = 0 for every value in Width. Also the Top and Left of controls are relative to the top-left corner of the form.
Report
Re: Put an object in the middle of the form Posted by porodoro on 3 Jan 2006 at 8:54 AM
Thanks ;).
and thats for the top (Y):

panel1.top:= (Form1.Clientheight div 2) - (Panel1.height div 2);
Report
Re: Put an object in the middle of the form Posted by jobromedia on 3 Jan 2006 at 2:48 PM
: Thanks ;).
: and thats for the top (Y):
:
: panel1.top:= (Form1.Clientheight div 2) - (Panel1.height div 2);
:
Hi, may I add a suggestion?

JEDI JVCL has a form scale component that will automatically scale the form you have done, so the component will not only be placed in the middle, but also resized propotional to the form.
Report
Re: Put an object in the middle of the form Posted by porodoro on 3 Jan 2006 at 8:20 PM
: : Thanks ;).
: : and thats for the top (Y):
: :
: : panel1.top:= (Form1.Clientheight div 2) - (Panel1.height div 2);
: :
: Hi, may I add a suggestion?
:
: JEDI JVCL has a form scale component that will automatically scale the form you have done, so the component will not only be placed in the middle, but also resized propotional to the form.
:
i'll have it in mind.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.