By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,826 Members | 2,443 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,826 IT Pros & Developers. It's quick & easy.

i want forms to auto adjust based on resolution of user

P: 62
I have designed forms in 1024 * 768 resolution.
All forms look good but when user opens database in higher resolution the form shrinks and looks ugly
is ther module using which i can auto adjust forms based on resolution of users system.
Nov 1 '13 #1

✓ answered by neelsfer

i use this little form to establish and set the screen resolution manually, as i am always worried that different versions of windows/office may affect the result.

Share this Question
Share on Google+
9 Replies


ADezii
Expert 5K+
P: 8,636
Rather than rely on Resolution Independant Code for Form Resizing which can be cludgy, and assuming you only have a couple of Forms, you can keep 2 Versions of your Forms.
  1. Check the Users Resolution.
  2. If the Screen resolution is
    Expand|Select|Wrap|Line Numbers
    1. (> 1024 and > 768) 
  3. Load Form A, else Load Form B which was designed in a Lower Resolution.
Nov 1 '13 #2

NeoPa
Expert Mod 15k+
P: 31,489
The first step is to determine the resolution of the screen, but you don't say if you have that covered yet. Do you? if not, then that is a question in itself.

It's certainly possible, if not necessarily straightforward, to develop code to handle resizing a form.

Personally, I would see providing multiple copies as a kludge rather than handling the resizing in code, but certainly it's a much easier solution to implement, though would obviously make maintenance more involved over time. That's not a lack of respect for ADezii. We don't always agree on everything but there are very few better to help on a question than them.

Only you know what you're really after, so you can choose the approach that best fits your requirements.
Nov 1 '13 #3

zmbd
Expert Mod 5K+
P: 5,397
I've ran into this issue many times.

. What I found with scaling using several differnent methods, is that the form then either lacks the space needed for the controls, and/or everything get's so crammed togeither that the form becomes unusable.

. So, I went with the same concept as ADeZii suggested, and as Neopa pointed out, this became a maintenance nightmare in very short order.

. So my solution: I went into the lab, found the smallest, worst case monitor, and built a template form and that is what I use to develop all the applications for the lab.

. Sorry, I tossed the scaling code... it had some API calls that I simply never took the time to learn... This is a VERY OLD thread Form Resizing Code that will give you an example as to what you are up against for resizing... it is NOT for the NOVICE coder!
Nov 4 '13 #4

ADezii
Expert 5K+
P: 8,636
I feel as though this is the perfect opportunity to demonstrate the concept of Form/Control Resizing. Unfortunately, due to the complexity of accomplishing this, I feel the need to Upload an Attachment. I'll only post the bare essentials here, and leave the rest up to you. Here goes:
  1. When you Open the Database, frmScaleTest will be displayed, consisting of a variety of Control Types.
  2. This Form was redesigned on my PC with the following Parameters:
    1. Horizontal Resolution: 1280
    2. Vertical Resolution: 738
    3. X Logical DPI: 96
    4. Y Logical DPI: 96
  3. Regardless of the End User's resolution, it should display appropriately based on the Parameters that were previously entered at Design Time.
  4. Change the Resolution, Maximize, Minimize, Restore the Form and all Controls as well as the Form itself should Resize.
  5. The Resolutions and DPI Values were obtained by opening frmScreenInfo (Button on frmScaleTest) which will display them along with a Procedure Call on the bottom of the Form.
  6. Substitute this Call for the one in the Form Open() Event, for my Resolution the Call looks like:
    Expand|Select|Wrap|Line Numbers
    1. Call frmResize.SetDesignCoords(1280, 738, 96, 96)
  7. Set the Options on frmScaleTest to Scale Controls, and or Fonts and Columns.
  8. Change the Resolution, Maximize, Minimize, Restore the Form and all Controls as well as the Form itself should Resize.
  9. Look at the Code in the Form's Open() and Load() Events as well as the single Standard Code Module and multiple Class Modules.
  10. After looking over everything, it may become clear as to why I suggested the Option of Multiple Forms.
Attached Files
File Type: zip Resolution.zip (210.2 KB, 1562 views)
Nov 5 '13 #5

100+
P: 547
i use this little form to establish and set the screen resolution manually, as i am always worried that different versions of windows/office may affect the result.
Attached Files
File Type: zip screen resolution.zip (57.3 KB, 1082 views)
File Type: zip screen resolution 2003mdb.zip (21.3 KB, 896 views)
Nov 5 '13 #6

NeoPa
Expert Mod 15k+
P: 31,489
10. After looking over everything, it may become clear as to why I suggested the option of Multiple Forms.
It may well be (almost certainly is to be fair) the most sensible approach - particularly for a less-experienced user. My comment was mainly directed at the terminology of describing doing it via code as a kludge. It seems clear we have different understandings of what that refers to.

As for the steps involved in resizing a form for different resolutions, that can certainly be extremely complicated, as you indicate. On the other hand, resizing itself can consist of more or fewer changes - depending on exactly what the designer needs in their 'resize'. It could consist of as little as changing the dimensions of the form itself and repositioning the controls across the newly sized form, which would be a job in itself of course, but not too daunting for an experienced coder.

I suspect that if the OP hasn't been frightened off this idea by now, with all the good posts explaining what it can involve, they are either quite competent coders themselves, or too inexperienced even to appreciate what they are being warned about. If in doubt then, go with the multiple versions of the forms as ADezii suggested in post #2. Only attempt to handle this with code if you are confident you have all the bases covered and that you can handle all the coding required - not straightforward in the least.
Nov 6 '13 #7

ADezii
Expert 5K+
P: 8,636
@NeoPa:
First of all, it is always a pleasure conversing with you. My concept on Resizing is that if you are going to Resize, 'Resize all the way'. The Attachment in my prior post originates from the Access Developers Handbook. Not only can it Resize Forms and their constituent Controls, but also (optionally) will Resize Sub-Forms and their Controls, Sub-Sub-Forms and their Controls, Scale Fonts, Resize Columns in List and Combo Boxes, etc. All the complexities are encapsulated in the Class Modules and Standard Module. Instantiating the Class and setting a couple of Options in the Open() Event of the Form is all that is needed. The advantage of this approach is that the End User needs to know absolutely nothing about the complex Code but only how to set a few Properties. I guess that I just contradicted myself with my prior statements - you are correct in stating that the
'Multiple Form Approach is kludgy'
. It now becomes a simple matter of To Resize or Not to Resize!
Nov 6 '13 #8

NeoPa
Expert Mod 15k+
P: 31,489
It now becomes a simple matter of To Resize or Not to Resize!
Indeed my friend - and you give many compelling reasons why this question should never be taken lightly :-)
Nov 7 '13 #9

NeoPa
Expert Mod 15k+
P: 31,489
As new questions are not allowed in existing threads I've moved this into a new one (Shrinking/Stretching Forms) for you.
Apr 24 '18 #10

Post your reply

Sign in to post your reply or Sign up for a free account.