Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

centering forms in a form 2

Status
Not open for further replies.

R17

Programmer
Jan 20, 2003
267
PH

i have a form that i want to center automatically when i run it inside another form..

i set align automatically to .T. .. but it is still not centering..

what should i do?
 
It depends on the ShowWindow property. If it's the default 1-In Screen, then it will center on the Screen if AutoCenter is .T. If the show window type is 3-As Toplevel, then it will be centered on the current desktop, and if 2-In Toplevel, then it will be centered in the Top Level form.

If you want another scenario, you'll need to get the appropriate properties from the VFP screen or desktop and then the size of your form, and manually compute it's new position - usually in the INIT().

Rick
 
I can say that I ever centered in another form so this one is coming from left-field.

If you know the Height, and Width properties of the parent form, you may be able to create a centering point.

For example - Parent:
Height = 300
Width = 600
-------------------
Child Form:
Height = 200
Width = 400

Taking the Height of the Parent, subtract the Height of the Child (300 - 200) give us 100. 100 / 2 = 50. The Top of the child form will be around 50.

Try the same concept for the Width in order to Determine the Left.

---

One other option is a FormSET, but I personally try to stay away from them if possible.






Jim Osieczonek
Delta Business Group, LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top