By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,491 Members | 3,132 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,491 IT Pros & Developers. It's quick & easy.

Center Form Stretching

Ali Rizwan
100+
P: 927
Hi all,
I m stretching my form and i want if i stretch its position after stretching must be in middle of screen or i want to stretch centerly.

Thanx
>> ALI <<
Feb 29 '08 #1
Share this Question
Share on Google+
5 Replies


daniel aristidou
100+
P: 491
Hi all,
I m stretching my form and i want if i stretch its position after stretching must be in middle of screen or i want to stretch centerly.

Thanx
>> ALI <<
Set the start up position to center?
Feb 29 '08 #2

Ali Rizwan
100+
P: 927
I want this at runtime......

thanx
Feb 29 '08 #3

daniel aristidou
100+
P: 491
I want this at runtime......

thanx
Okk.....this is a genral formula

Get the screen size (width)
Divide screen size by 2
Get form size (width)
Divide screen size by 2

Set the form position.left = (0.5 * Screensize) + (0.5 * Form width)
Do the same for the hieght

Hope this helps
Mar 2 '08 #4

Expert 5K+
P: 8,434
Correction.

Rather than...
Set the form position.left = (0.5 * Screensize) + (0.5 * Form width)
I'm fairly certain it should be...
Set the form position.left = (0.5 * Screensize) - (0.5 * Form width)
Mar 3 '08 #5

daniel aristidou
100+
P: 491
Correction.

Rather than...
Set the form position.left = (0.5 * Screensize) + (0.5 * Form width)
I'm fairly certain it should be...
Set the form position.left = (0.5 * Screensize) - (0.5 * Form width)
Yep your correct killer......
Mar 4 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.