Recent

Author Topic: How to align two forms  (Read 2984 times)

PeterKa

  • Newbie
  • Posts: 2
How to align two forms
« on: February 06, 2013, 03:04:12 pm »
I have a mainmenu form that calls a second form. The second form  is now created just where it was at design time, and I want it to be within the borders of my mainmenu.
What must I do for the second form to fill my mainmenu form.

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: How to align two forms
« Reply #1 on: February 06, 2013, 03:17:29 pm »
Set the second Form.Position:= poMainFormCenter in the Property Editor.
Lazarus Trunk / fpc 2.6.2 / Win32

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: How to align two forms
« Reply #2 on: February 06, 2013, 03:37:24 pm »
Code: [Select]
  Form2.SetBounds(Form1.Left, Form1.Top, Form1.Width, Form1.Height);
  Form2.Show;

Luke Snowmaker

  • New Member
  • *
  • Posts: 11
  • "Who are you...?" -"Nobody..."
Re: How to align two forms
« Reply #3 on: February 08, 2013, 10:36:36 pm »
...but...are you speaking about parent and child form or is your point only to have your second form over your mainmenu form in the center independently or something like that...?

For the parent/child forms (means, that your child form floats inside of the parent one, which should be mainmenu), you can set the FormStyle property of your mainform to fsMDIForm and to the invoked form set this to fsMDIChild.
« Last Edit: February 08, 2013, 10:51:54 pm by Luke Snowmaker »
openSUSE 12.2
Lazarus IDE 1.0.4/FPC 2.6.0

 

TinyPortal © 2005-2018