Can a form automatically open and resize based on the screen resolution

Comments

2 comments

  • Avatar
    Technical Support

    Total Access Components does not offer this functionality as a core feature. However, this can be accomplished by adding some custom VBA code to your application. Below is an example which may work in many cases (depending upon the design of your application). This sample code is designed to provide a demonstration of this task using Visual Basic for Access Applications Programming. Please note that this code is intended and provided as an example only. Support for the custom integration of this code within your application is beyond the scope of FMS Technical Support.

    Create a new module, and type the following Declarations and function:

    Option Compare Database
    Option Explicit
    
    Type RECT
      x1 As Long
      y1 As Long
      x2 As Long
      y2 As Long
    End Type
    
    ' NOTE: The following declare statements are case sensitive.
    
    Declare Function GetDesktopWindow Lib "User32" () As Long
    Declare Function GetWindowRect Lib "User32" _
    	 (ByVal hWnd As Long, rectangle As RECT) As Long
    
    '*****************************************************************
    ' FUNCTION: GetScreenResolution()
    '
    ' PURPOSE:
    '   To determine the current screen size or resolution.
    '
    ' RETURN:
    '   The current screen resolution. Typically one of the following:
    '      640 x 480
    '      800 x 600
    '      1024 x 768
    '
    '*****************************************************************
    Function GetScreenResolution () as String
      Dim R As RECT
      Dim hWnd As Long
      Dim RetVal As Long
      hWnd = GetDesktopWindow()
      RetVal = GetWindowRect(hWnd, R)
      GetScreenResolution = (R.x2 - R.x1) & "x" & (R.y2 - R.y1)
    End Function

     

    On the View menu, click Debug window.

    Type the following line in the Debug window, and then press ENTER:
    ? GetScreenResolution()

    Note that the current screen resolution is displayed in the Debug window.

    Once the Screen Resolution is found, you can then resize the form to the resolution size found. When the form is resized, the OnResize event for the form will also fire, thus firing the code for the control.

    0
    Comment actions Permalink
  • Avatar
    Rachel Gomez

    Go to Access settings=> document window options and select tabbed documents . Any form you want to have specific size, you can then set as "popup". You can still have your custom form with custom bg colour, size 1cmx1cm, no scroll, no navigation bar, no record selctor, borderstyle none .

    Regards,

    Rachel Gomez

    0
    Comment actions Permalink

Please sign in to leave a comment.