If all your applications will only be used with the same monitor and resolution, there is no benefit in using automatic form resizing.
However if you are designing applications for use with a variety of different display options, it may be exactly the solution you need
Most developers will be aware that forms designed for a specific screen size/resolution may look dreadful on a different monitor with a higher/lower resolution
and /or screen size or shape (form factor = 4:3, 16:9 or widescreen)
For example, this form was designed at a low resolution (800*600):
Difficulty level : Moderate
Click any image to view a larger version
If it is viewed at a higher resolution (1680*1020), it only fills part of the screen and each item is tiny.
This is the result using overlapping windows
Using tabbed documents, the screen is filled but the contents remain squashed in the top left corner
On a smaller screen or lower resolution, the opposite problem occurs with part of the form not shown unless the user scrolls in both directions
The effect is the same whether using overlapping windows or tabbed documents.
So what solutions exist?
In addition anchoring can be used to adjust the position/size on the screen.
There are 9 different anchoring options available. In this case Stretch Down and Across anchoring has been applied
The results can be quite successful for simple form layouts.
However, that isn’t necessarily the case for more complex form designs. For example, extra controls have been added in design view:
Depending on the anchoring choices, this may result in this layout (with lots of empty space on the left)
Or another variation - in this case with various controls overlapping / obscured … etc
With care and practice, reasonable results can still be obtained. However, the process is far from intuitive.
The main issue with this approach is that users do not have full control over positioning and size of each control on the form
Automatic form resizing code is designed to fix all such issues.
Forms can be automatically resized for any screen size & resolution whilst allowing developers full control over the form layout and appearance.
There are various examples available including commercial packages such as:
- Shrinker Stretcher available from http://www.peterssoftware.com/ss.htm
- Total Access Components from http://www.fmsinc.com/microsoftaccess/controls.html
However, for many years, I have used a modified version of free open source code by Jamie Czernik originally written in 2003. The original code is still available
at http://jamieczernik.powweb.com/articles/resolution.html though many improvements have been added since by myself and other developers.
This is an identical form to that shown earlier in this article, designed at 800*600 but with form resizing code added.
Firstly, here is the form viewed at a resolution of 1024*768
And again at a resolution of 1440 *900
And yet again at a resolution of 1680*1050
As you can see the entire form is shown whatever resolution is used as long as that is the same as or higher than the ‘design resolution’.
The code intelligently enlarges the form itself to fit the screen and moves each control by an appropriate amount to keep the form in proportion.
It also enlarges each control proportionately together with the contents of that control.
The code works for each type of control including subforms
1. The code has been extensively tested with many clients and applications over a period of 15 years.
It has been used with a wide range of monitors and form factors (screen shapes & resolutions) including 22 inch widescreen, 14 inch 16:9, 15 inch 4:3
and a 10 inch 16:9 tablet
2. When using a maximised form as above, some 'empty space' may be left on the right of the screen.
This is to allow for different form factors such as 4:3, 5:4, 16:9, 16:10, widescreen
So what code is needed to work this magic? Just one line in the Form_Load event: ResizeForm Me
OK, I hear you say, surely that can't be all there is to it! Well not quite...!
Behind the scenes there is a lengthy module modResizeForm which contains all the code required to adjust the forms as required.
This code module is included with the attached example application and has been updated to work in both 32-bit and 64-bit Access
If you import the module to your own applications and add the above line in the Form_Load events, all forms will be resized.
However, the results will not be at all successful at first unless the forms were designed with resizing in mind
It is STRONGLY recommended that you start with new forms and plan for resizing from the start.
Designing with the form resizer
As a general rule, you always need to develop using the lowest resolution that your users are likely to have.
Form resizing upwards (stretching) is much easier and has far fewer issues than resizing downwards (shrinking).
The declarations section of the modResizeForm module includes the following lines:
The first line is the default or baseline horizontal resolution - in this case 800
You can adjust this to any other suitable minimum value such as 1024 if you prefer
The next line is the baseline vertical resolution - 600
This can also be amended to suit, but in the current version of the code this is NOT used & can be disabled
The third line is the pixels per inch setting which is normally 96 for 100%
NOTE: if the screen is magnified to e.g. 125% this value becomes 120 ppi
Setting the default form size
The code currently specifies a 'base resolution' of 800*600 though that can be changed to any resolution that suits your needs.
However I certainly don't develop in that resolution. My primary monitor is in fact 1680*1050 and my secondary monitor is 1920*1080.
What it actually means is that my base form size in design view is such that if I did use 800*600, it would fill the screen.
By experiment, I found that size should be 20.5cm*12.5cm approximately
So my forms are designed in that size & will scale up to 'fill the screen' in any other higher resolution
More accurately it will fill the total height of the screen.
Due to different form factors (4:3, 5:4, 16:9, 16:10 etc) the form may be slightly less than the total monitor width.
Whilst I could stretch it to fit horizontally, there would be some distortion by doing so
Alternatively you could increase the default width of your forms in design view
I also design with default font = Calibri 7pt which after resizing becomes Calibri 11pt
I could change the base resolution to say 1024*768 and if I did so, the base form size would be proportionately larger (25.85*17.2 cm approx)
and the font size would be 9pt in design view. However, it would scale up from that equally well.
NOTE: You may wish to adjust the default width if, for example, all users have monitors with widescreen form factor.
You may also need to adapt the specified sizes slightly if you normally do any of the following:
a) Set ribbon and / or navigation pane maximised
b) Design forms with no header / footer section
c) Use tabbed documents instead of overlapping windows
d) Use popup forms
The attached application includes three example template forms (800x600, 1024x768 and 1366x768).
These may be useful to set maximum form sizes to ensure they fit properly in different screen resolutions and form facors.
1024*768 template (form factor = 4:3)
The first part of this article has discussed the benefits of automatic form resizing as well as an alternative approach based on the use of the built in
layout guides and anchoring.
The second part of the article adds an optional zoom feature to Access forms - this can be very useful for those with less than perfect eyesight.
This section also covers some potential issues you may experience and possible solutions for each of these.
The third part of the article will explain how the resizing code works and provide tips for using the code most effectively in your own applications.
What is automatic form resizing and why is it useful?
Layout guides were added in Access 2007 to help developers create consistent form layouts by grouping controls together.
Some developers find layout guides useful to some extent in managing issues with different screen sizes and resolutions
For example, a stacked layout has been used for these controls. All controls in the group are automatically made the same width
Layout Guides and Anchoring
It is useful to place a transparent box control over each section of the form to mark out the correct size required.
The box should be equal to the width and height of that section.
This will be useful if you need to restore the original size after making any temporary changes in form layout / size
800*600 template (form factor = 4:3)
Click the links to download various items related to this topic:
1. The original auto form resize utility by Jamie Czernik - afr.zip (MDB zipped)
2. The example application referenced in this article - ResizeFormExample_v3.6.zip (ACCDB file zipped)
3. The complete article as a PDF document - ResizeForm Me.pdf (PDF zipped)
4. I ran a session on Automatic Form Resizing for the US Lunchtime Access User Group on 28 Sept 2021.
The video is available on You Tube at: https://youtu.be/-mgIvCosYtU
Many thanks to Crystal Long (MVP) for the considerable time she spent expertly editing the video recording of this session.
I would be grateful for any feedback on this article including details of any errors or omissions
If you have any comments or questions, please contact me using the feedback form below or click the email button
To provide feedback on this article, please enter your name, e-mail address and company (optional) below, add your comment and press the submit button. Thanks
Click any image to view a larger version
Colin Riddington Mendip Data Systems Updated 25/11/2021