Maximised Switchboard with normal size Forms (1 Viewer)

treva26

Registered User.
Local time
Today, 01:44
Joined
Sep 19, 2007
Messages
113
Is it possible to have the Switchboard maximised but have all other forms open not maximised?

OR can you detect the screen size available and set the switchboard to that size (ie ReSize not Maximise).

I have it set big but some people have different resolution monitors.
 

Luka

Registered User.
Local time
Today, 09:44
Joined
Oct 29, 2004
Messages
40
Try setting PopUp property on other forms to true.

But otherwise search web i remember that i saw some code which sync forms size with monitor resolution (peters software or somthing like this).
 

treva26

Registered User.
Local time
Today, 01:44
Joined
Sep 19, 2007
Messages
113
Yea I found it.

You just put this code in a new module:

Code:
Option Compare Database

'*************************** Code Start ************************
'This code was originally written by Terry Kreft.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code courtesy of
'Terry Kreft
'
Type Rect
    x1 As Long
    y1 As Long
    x2 As Long
    y2 As Long
End Type
Declare Function IsZoomed Lib "user32" (ByVal hWnd As Long) As Long
Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal _
    nCmdShow As Long) As Long
Declare Function MoveWindow Lib "user32" (ByVal hWnd As Long, ByVal _
    X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight _
    As Long, ByVal bRepaint As Long) As Long
Declare Function GetParent Lib "user32" (ByVal hWnd As Long) As Long
'Use following instead of GetWindowRect
Declare Function GetClientRect Lib "user32" (ByVal hWnd As Long, lpRect _
    As Rect) As Long

Public Const SW_MAXIMIZE = 3
Public Const SW_SHOWNORMAL = 1

Sub MaximizeRestoredForm(F As Form)
    Dim MDIRect As Rect
    ' If the form is maximized, restore it.
    If IsZoomed(F.hWnd) <> 0 Then
        ShowWindow F.hWnd, SW_SHOWNORMAL
    End If
    ' Get the screen coordinates and window size of the
    ' MDIClient area.
    'This is the line which is different
    GetClientRect GetParent(F.hWnd), MDIRect
    ' Move the form to the upper left corner of the MDIClient
    ' window (0,0) and size it to the same size as the
    ' MDIClient window.
    MoveWindow F.hWnd, 0, 0, MDIRect.x2 - MDIRect.x1, MDIRect.y2 - MDIRect.y1, True
End Sub
'*************************** Code End ************************

Then set the Switchboards form property:

Code:
Private Sub Form_Activate()
Call MaximizeRestoredForm(Me)
End Sub

Works like a charm.
Switchboard stays maximised, everything else is normal size.
(and all windows have controls)
 

Jen_RT

Registered User.
Local time
Today, 08:44
Joined
Jan 19, 2010
Messages
30
Spent hours looking for this solution. Cheers :) but do you know how to get the form to automatically centre? I have tried autocentre = yes but it doesn't work. :confused:
 

Users who are viewing this thread

Top Bottom