From version 5 there is a form property for centering the form, (caren't remember what it's called but towards the bottom of the properties list). Maybe cut out the centering code from your app and use this property method.