As you mention, you could determine the available screen space. You are going to have a somewhat complex job because you will have to set the top and left of every visible control on the screen. That is one way of doing it that will work.
The other way would be to redesign the form using layouts as I mentioned, and this also has a learning curve and there are not many people who use it, hence you have not seen much info on using layouts on the web.
I will come back later today and give a more thorough answer for you, but the basics are:
- Convert your existing design to a layout by selecting the controls on the form that you want centered.
- Size your form to the smallest visible area it will be allowed to go
- Add an empty row to the layout on the top and an empty row to the layout on the bottom.
- Add an empty column to the left of the layout and an empty column to the right of the layout
- Merge the cells together in the empty rows so you only have one cell on the top and bottom
- Merge the cells together in the columns so you have one cell on the left and on the right
- Change the Horizontal Anchor property to “Both” for the empty columns on either side of the form
- Change the Vertical Anchor property to “Both” for the empty rows at the top and bottom of the form
I may have missed something with making corners for the layout that would need the Horizontal and Vertical Anchor properties both set to “Both”, but I will re-test this and make any corrections later today.
Ok, I am attaching a database with a demo form to show you an example.
See the images highlighting the whole layout, the top and bottom cells Vertically Anchored to both top and bottom, and the left and right cells Horizontally Anchored to both top and bottom.
This will cause the blank cells to stretch to fit the form as it grows.
You will want to center the layout and use the smallest size of the form you want it to be able to shrink to. Once the user makes the window smaller, it will simply stop moving the middle section and cut it off. You can configure it to add scrollbars in this case using the scrollbars option for the form.
Note that if you have anything in the Form Header section it will always be at the very top of the window, and anything in the Form Footer will always be at the very bottom of the Form when you are displaying it.
You can add, resize, and manipulate cells and blank cells to get whatever relative formatting you need. Note that any label or field inside a cell will always fill the cell entirely.