sermoc
03-26-2003, 05:48 AM
Someone have a routine to center controls in a maximized form?
Thanks
Thanks
Center Controls in formsermoc 03-26-2003, 05:48 AM Someone have a routine to center controls in a maximized form? Thanks Pookie 03-26-2003, 06:14 AM Controls, as in plural... How many controls? What sizes are they? What type are they? How should they be aligned? Beside each other, or spaced apart, or relates to the form size... I have questions! I need answers!!! :D sermoc 03-26-2003, 08:01 AM I only need to know how center these controls (buttons, checkbox, flexgrids...) in the maximized form. I don't want to change the size, however I want to know the correct lines so I could center them from normal form to maximized form. Thanks. Pookie 03-26-2003, 08:40 AM Ok, so you want the whole form centred within a maximized form You could first get the original size of the form in the formload after using the me.show me.show x = me.width y = me.width me.windowstate = vbmaximized xnew = me.width ynew = me.width Now you know the original size of the form, and the size of the form maxed out. So now you just need to calc the difference devide by 2 to know the offset to move everything: dim ctl As control For each ctl in controls ctl.Move ctl.Left + (xnew - x) / 2, ctl.Top + (ynew - Y) / 2 Next This is all theory so it may not center, but i'm sure you get the idea... ;) sermoc 03-27-2003, 04:58 AM Thanks a lot... I got it ;) Greetings |
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum