I must be crazy having spent so much time on this and getting no where! I have a form that most of the time is set to a specific size, 300 x 200. In certain instances, the form is expanded to 570 when a menu command is clicked. When the command is clicked or another is clicked that takes the form back to 300x200, I am trying to get a couple of objects move into the new center.
This is the code used to move the object to center:
frmNotice.Width= 300 frmNotice.logo.Left = (frmNotice.Width - frmNotice.Logo.Width)/2
Or if the window grows this code is used:
frmNotice.Width= 570 frmNotice.logo.Left = (frmNotice.Width - frmNotice.Logo.Width)/2
I have tried different code, and code in different events/methods, but it never seems to work consistently. In some cases it will work on the second selection (when the same size window is created). I cannot figure this out!
Can anyone suggest how to do this properly?