screen size problem

LarryMann used Ask the Experts™
How do you adjust the forms so that they can be viewed on any screen size?

I developed a program on a computer with it's screen set at 1024 X 768 and tried to run it later at 800 X 600. Large portions of the form were off-screen and now I can't figure out how to change it.  It will need to be viewed on a computer with 800 X 600 screen size.

How can I do this without starting all over?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

There are several solutions, but ultimately you should learn that apps should always be developed with end-user systems in mind.

Option 1:
Place the entire form contents into a borderless frame, add a set of scrollbars, and make the scrollbars control the view-window.

Option 2:
Re-design the form to fit in 800x600 resolution, possibly moving things into a tab control's tabs

Option 3: (not recommended)
Resize all controls on the form in the ReSize event so that everything fits proportional to the original.  The main problems with this are that some controls refuse to be resized (like comboboxes) unless you change other things (like fonts) which can have side-effects (jagged-fonts), or their resizing may not be precise (listboxes don't like to resize unless you shrink them just right or set a property) or the resizing may force things to wrap (captions) or become less usable (like textboxes for phone numbers shortened so the number does not display.

Option 4:
Get a replacement set of controls that automatically resize based on various system settings.

I would recommend #2 first, then #1, but not the other two.


Basically, I had started it using 800 X 600 resolution and ended up moving to another computer with different resolution.  Then when I tried to go back to my computer, it no longer sized correctly.
 I've tried the code from twalgrave and it did not work, it still would not show the entire form when I resized the screen.
 I also tried moving the componants on the page so they would fit on the 800 X 600 screen, but I can not get to the whole form this way.  I made the form as large as I could to edit it, but there was still a large amount of space on the right of the screen that I couldn't get to, but could see when the program was run.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

can do one more thing.
When u load the project u can change the system resolution to 1024*.. and while unloading u can come back to the same one which the user has kept.
If u need the code.pls reply, i will post it
Good Luck...


The main users of the system will be using 1024 X 768 resolution. I am supposed to do a presentation, but the computer in the presantation room only goes up to 800 X 600.
Then I guess the simplest answer is my option #1 above.  First cut all controls, add a new frame and paste into the frame.  Set the frame to position (0,0) with the 1024x768 size that you had the form at before--essentially full-size.  Also add a dummy picturebox to fill the lower-right corner  Next add a horizontal and vertical scroll bar and this code:

' Force the scrollbars to the right and bottom
Private Sub Form_Resize()
  HScroll1.Move 0, Me.ScaleHeight - HScroll1.Height, Me.ScaleWidth - VScroll1.Width
  VScroll1.Move Me.ScaleWidth - VScroll1.Width, 0, VScroll1.Width, Me.ScaleHeight - HScroll1.Height
  Picture1.Move VScroll1.Left, HScroll1.Top, VScroll1.Width, HScroll1.Height
End Sub

' Set initial scroll parameters
Private sub Form_Load()
'...other code
  HScroll1.Min = 0
  HScroll1.Max = Frame1.Width
  HScroll1.Value = 0
  HScroll1.SmallChange = Screen.TwipsPerPixelX
  HScroll1.LargeChange = 100
  VScroll1.Min = 0
  VScroll1.Max = Frame1.Height
  VScroll1.Value = 0
  VScroll1.SmallChange = Screen.TwipsPerPixelY
  VScroll1.LargeChange = 100
End Sub

' Scroll the frame when clicked or dragged

Private Sub HScroll1_Change()
  Frame1.Left = -HScroll1.Value
End Sub

Private Sub HScroll1_Scroll()
End Sub

Private Sub VScroll1_Change()
  Frame1.Top = -VScroll1.Value
End Sub

Private Sub VScroll1_Scroll()
End Sub

Oh, yeah...note that the above will scroll the frame entirely out of the window.  To make it scroll so that the right or bottom frame edge never go less than the right or bottom window edge, add some extra code in the resize to reset the Max values, something like this (untested):

Private Sub Form_Resize()
'...other stuff

' TO DO: watch out for the windowsize exceeding the frame size
HScroll1.Max = Frame1.Width - Me.ScaleWidth
VScroll1.Max = Frame1.Height - Me.ScaleHeight
end sub


Thanks, not quite as simple as I was hoping for, but I won't make that mistake again.

>not quite as simple as I was hoping

That's why we're here :)

Thanks for the "A" grade.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial