Application window size

  • Thread starter Thread starter Jim Franklin
  • Start date Start date
J

Jim Franklin

Hi,

I am using Access 2007 and I need to have a maximised datasheet form with a
header and footer section. No problem, I am just going to use a subform. But
the users of the app are all going to be using different screen resolutions.
So I thought I would pick up the application window size and re-size the
main form and subform when the form loads. I'm not worried about re-sizing
any other controls, or changing font sizes etc.

Does anyone know the easiest way to do this?

Many thanks,
Jim
 
Having the form correspond to the screen size can cause a problem if
you have other controls on the main form. For instance if you have an
"Exit" button or maybe a special function button on the main form and
it is outside of the area that is accessable on a low resolution
monitor the user will NOT be able to get to or see the button.

What I have done is simply to design two main forms with the datasheet
subform being a different size on the two forms. And even then I set
the high resolution form to use only about 7/8ths of the full screen
for the subform. On most of my forms I have a specific exit function
button on the form. For the High Res form I positioned the button so
that even if a Low Res user opened it they could see and access the
button.

The reason for not using what is the full high res size is that there
are many different high res monitors and they do not all resolve to
the same. Meaning that what is visible on my high res monitor may not
be visible on a different high res monitor.

Also if you opened the high res on a low res and are in the subform
you cannot see any of the fields that are off to the right of the
subform even if you have tabbed into them from another field.

With that being said, below is the code that can get you the screen
resolution:

========================================

dim scrWidth as integer
dim scrHeight as integer

scrWidth = apiGetsys(SM_CYSCREEN)
scrHeight = apiGetsys(SM_CXSCREEN)


Function and what to request shown below.

==================================================
Public Declare Function apiGetSys Lib "user32" _
Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long


'*** Define API Constants ***
Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1
Public Const SM_CXVSCROLL = 2
Public Const SM_CYHSCROLL = 3
Public Const SM_CYCAPTION = 4
Public Const SM_CXBORDER = 5
Public Const SM_CYBORDER = 6
Public Const SM_CXDLGFRAME = 7
Public Const SM_CYDLGFRAME = 8
Public Const SM_CYVTHUMB = 9
Public Const SM_CXHTHUMB = 10
Public Const SM_CXICON = 11
Public Const SM_CYICON = 12
Public Const SM_CXCURSOR = 13
Public Const SM_CYCURSOR = 14
Public Const SM_CYMENU = 15
Public Const SM_CXFULLSCREEN = 16
Public Const SM_CYFULLSCREEN = 17
Public Const SM_CYKANJIWINDOW = 18
Public Const SM_MOUSEPRESENT = 19
Public Const SM_CYVSCROLL = 20
Public Const SM_CXHSCROLL = 21
Public Const SM_DEBUG = 22
Public Const SM_SWAPBUTTON = 23
Public Const SM_RESERVED1 = 24
Public Const SM_RESERVED2 = 25
Public Const SM_RESERVED3 = 26
Public Const SM_RESERVED4 = 27
Public Const SM_CXMIN = 28
Public Const SM_CYMIN = 29
Public Const SM_CXSIZE = 30
Public Const SM_CYSIZE = 31
Public Const SM_CXFRAME = 32
Public Const SM_CYFRAME = 33
Public Const SM_CXMINTRACK = 34
Public Const SM_CYMINTRACK = 35
Public Const SM_CXDOUBLECLK = 36
Public Const SM_CYDOUBLECLK = 37
Public Const SM_CXICONSPACING = 38
Public Const SM_CYICONSPACING = 39
Public Const SM_MENUDROPALIGNMENT = 40
Public Const SM_PENWINDOWS = 41
Public Const SM_DBCSENABLED = 42
Public Const SM_CMOUSEBUTTONS = 43
Public Const SM_CMETRICS = 44

================================================

Good luck and have some fun with it.

Ron
 
Hi Ron,

Thanks for this. I realised I was going to have to be careful with placement
of controls on the main form - basically I have only got a few cmd buttons
to worry about, so I have placed them all to the left so they are always
visible, regardless of the size of the form.

I think I have got it cracked now, using the code you provided. Thanks for
all your help,

Jim
 
Back
Top