435,491 Members | 3,132 Online
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

 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
5 Replies

 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

 100+ P: 927 I want this at runtime...... thanx Feb 29 '08 #3

 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

 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