Adjusting form size to screen resolution

  • Thread starter Thread starter Miha Abrahamsberg
  • Start date Start date
M

Miha Abrahamsberg

Hi,

I use:

########
Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As
Long
Public Function GetScreenResolution() As String
'returns the screen resolution
'GetSystemMetrics (0) is the Width
'GetSystemMetrics (1) is the Height
GetScreenResolution = GetSystemMetrics(0) & "x" & GetSystemMetrics(1)
End Function
########

to get the user's screen resolution and I adjust certain forms' (size, font)
according to it.

But I have a problem where some of "my end users" use 2 screens (multiple
desktops) and one screen uses higher resolution then the other.

In such cases the function GetScreenResolution returns the default's screen
resolution.

How should I adjust the code to be able to get both screens resolution
information?

Miha
 
Someone may be able to suggest an API call that works with particular
versions of Windows that handle multiple screens and gives you the
resolution for each screen.

You would also need to know which screen your application is on, and have
some kind of event handler that notifies you when the user switches it to a
different screen.

One of my 2 screens is in portrait mode. I find that brilliant for
developing: the main Access app under development displays on the landscape
screen, and the VBA IDE goes on the portrait screen showing > 100 lines of
code at once. This kind of thing:
http://allenbrowne.com/temp/monitor.jpg
So you would need to adapt your application to that.

Saw a setup with 4 monitors last week. That should give you some fun.

Presumably you also need to be notified if the user restores the app into a
window that is not using the whole screen, or changes the size of the
application window. And you have to handle any pop-up screens that open
outside the main Access window. And handle any changes Microsoft may make in
future (like they did in A2007.)

In the end, I seriously question whether this approach is a good one.
Personally, I hate applications that believe I bought a large screen just so
they could take up the whole thing. IMHO, you are better off to specify a
minimum resolution for running your app (e.g. 1024 x 768), and build it for
that.
 
Back
Top