How to adapt an application to use the resolution of the target environment?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • neelsfer
    Contributor
    • Oct 2010
    • 547

    #1

    How to adapt an application to use the resolution of the target environment?

    I need some advice about the screen resolution of one of my apps, that i am rewriting currently from scratch. (i must admit - it was my first ever app i did 3 yrs ago, and was badly written)
    I started doing programming it on my 23" flat screen at home(1920x1080) , and now it is proportionally wrong on the old conventional box screens (1024x768), when i take it to work. I have to make everything much smaller in the application to make it fit.
    Any suggestions on how to deal with this issue please?
  • neelsfer
    Contributor
    • Oct 2010
    • 547

    #2
    i have changed the screen resolution to 1280x1024 and it seems much better. Is there a way to adapt the vba to work at this resolution on opening, and revert back to the previous settings on closing the application?

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      I suppose you could pull the screen resolution at start and then loop through all the controls and multiply their width by a percentage.

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        The appropriate answer would be to write Resolution Independent Code which will work properly at any Resolution but can become rather complex since all Controls would have to be dynamically resized. A simpler approach that I have taken in the past, assuming only a couple of Forms are utilized, is to check the Screen Resolution at the very beginning and show a specific Form depending on the outcome. Pseudo Code would look like:
        Code:
        If Horizontal Resolution is <= 1280 and Vertical Resolution <=1024 Then
          'Show Form A
        Else
          'Show Form B
        End If

        Comment

        • TheSmileyCoder
          Recognized Expert Moderator Top Contributor
          • Dec 2009
          • 2322

          #5
          Access 2007+ has the feature of anchoring. The basic concept is that you tell access which corner of the each control is fixed, and if you want the control to stretch when the form is resized.
          The issue is that there is no bulletproof way for any code to know which objects should resize.

          There are rule of thumbs probably, like comboboxes should not resize. But what about textboxes? If you are using it for a date value, you probably don't want it resized because you have prepared it for whatever size will fit a date. On the other hand if your textbox is bound to a memo field, you might want it to expand, since memo fields are usually for large blocks of text.

          Anyway, using anchoring in 2007+ is a nice fit for most of these needs, and with no code required.

          Comment

          • dsatino
            Contributor
            • May 2010
            • 393

            #6
            For Rabbits resize method:

            I've tried this method. It can work, but everything get very quirky looking. Sometimes even 'cartoony', for lack of a better phrase. I wouldn't recommend it.

            Comment

            Working...