Link to home
Start Free TrialLog in
Avatar of A G
A GFlag for United States of America

asked on

Screen Resolution Problem on Userforms

I have a huge form. The dimensions are:
Height: 787.5
Width: 1000

I produced on a 1680x1050 computer. When I tried it on other computers, the form didnt look as nice .
So I found the code below.

So I use scrollbars and zoom to overcome this problem.

1. My first question is how can I make this screen resolution code more flexible so it works on any type of screen resolution and looks nic.
2. Is there an easier and more efficient way to overcome the resolution problem.
With Application
.WindowState = xlMaximized
If x > 0 And y > 0 Then
'1680-1050
    If x = 1680 And y = 1050 Then
Me.Zoom = Int(.Height / Me.Height * 120)
Me.Width = .Width * 1#
Me.Height = .Height
'MsgBox x & " " & y

Me.ScrollBars = fmScrollBarsBoth
        Me.ScrollHeight = Me.InsideHeight * 1.3
        Me.ScrollWidth = Me.InsideWidth * 1.3
End If

'1280 - 1024
 If x = 1280 And y = 1024 Then
Zoom = Int(.Height / Me.Height * 140)
Me.Width = .Width * 1#
Me.Height = .Height
Me.ScrollBars = fmScrollBarsBoth
Me.ScrollHeight = Me.InsideHeight * 2
Me.ScrollWidth = Me.InsideWidth * 2
End If

 If x = 1280 And y = 960 Then
Zoom = Int(.Height / Me.Height * 160)
Me.Width = .Width * 1#
Me.Height = .Height
Me.ScrollBars = fmScrollBarsBoth
Me.ScrollHeight = Me.InsideHeight * 2
Me.ScrollWidth = Me.InsideWidth * 2

End If

 If x = 1280 And y = 768 Then
Zoom = Int(.Height / Me.Height * 140)
Me.Width = .Width * 1#
Me.Height = .Height
Me.ScrollBars = fmScrollBarsBoth
Me.ScrollHeight = Me.InsideHeight * 2
Me.ScrollWidth = Me.InsideWidth * 2

End If
 If x = 1152 And y = 864 Then
Zoom = Int(.Height / Me.Height * 160)
Me.Width = .Width * 1#
Me.Height = .Height
Me.ScrollBars = fmScrollBarsBoth
Me.ScrollHeight = Me.InsideHeight * 1.6
Me.ScrollWidth = Me.InsideWidth * 1.6

End If
 If x = 1024 And y = 768 Then
Zoom = Int(.Height / Me.Height * 180)
Me.Width = .Width * 1#
Me.Height = .Height
Me.ScrollBars = fmScrollBarsBoth
Me.ScrollHeight = Me.InsideHeight * 1.8
Me.ScrollWidth = Me.InsideWidth * 1.8

End If
 If x = 800 And y = 600 Then
Zoom = Int(.Height / Me.Height * 200)
Me.Width = .Width * 1#
Me.Height = .Height
Me.ScrollBars = fmScrollBarsBoth
Me.ScrollHeight = Me.InsideHeight * 2
Me.ScrollWidth = Me.InsideWidth * 2

End If

Else
Zoom = Int(.Height / Me.Height * 200)
Me.Width = .Width * 1#
Me.Height = .Height
Me.ScrollBars = fmScrollBarsBoth
Me.ScrollHeight = Me.InsideHeight * 2
Me.ScrollWidth = Me.InsideWidth * 2

End If
End With

Open in new window

Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

I suggest making it look OK in the lowest likely resolution, (probably 1024x768), and use the MultiPage control to show subsets of the controls with related functions.
ASKER CERTIFIED SOLUTION
Avatar of cd_morris
cd_morris
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial