JMongi
Active member
- Local time
- Today, 00:32
- Joined
- Jan 6, 2021
- Messages
- 802
I specify the size of the form on load. This parameters have not changed recently. However, without a seeming reason, sometimes the form shows up resized (all controls resized). I do have a VBA module that is for resizing forms, but it's not being used at the moment. So, I'm at a loss. Mainly because it's not consistent. If I was inadvertently calling resize code, or hooking into it somehow, it would do so every time. But, sometimes it does and sometimes it doesn't. It's confusing. I'm going to delete the module for the time being and see if that eliminates it. But, I wanted to post here to see if anyone had any ideas. Here is a sample of my form code.
The Load Code is using Application UI hiding from @isladogs
Code:
Private Sub Form_Open(Cancel As Integer)
Dim Rt As Integer
Dim Dn As Integer
Dim Wd As Integer
Dim Ht As Integer
Me.Painting = False
'Position and Size in TWIPS, 1440 TWIPS per inch
Rt = OldFormLeft + 24
'Debug.Print Me.Name & " " & "Rt= " & Rt
Dn = OldFormTop + 372
'Debug.Print Me.Name & " " & "Dn= " & Dn
Wd = 10 * 1440
'Debug.Print Me.Name & " " & "Wd= " & Wd
Ht = 8.25 * 1440
'Debug.Print Me.Name & " " & "Ht= " & Ht
DoCmd.MoveSize Rt, Dn, Wd, Ht
Me.Painting = True
End Sub
Code:
Private Sub Form_Load()
On Error GoTo ErrHandler
Select Case Me.OpenArgs
Case "AI_Show" 'show application interface
DoCmd.Restore
Case "AI_Hide" 'hide application interface
Me.Painting = False
'omit the ...Or WS_EX_APPWINDOW ...section to hide the taskbar icon
SetWindowLong Me.hWnd, GWL_EXSTYLE, GetWindowLong(Me.hWnd, GWL_EXSTYLE) Or WS_EX_APPWINDOW
ShowWindow Application.hWndAccessApp, SW_HIDE
ShowWindow Me.hWnd, SW_SHOW
Me.Painting = True
End Select
DeveloperMode = True
'Get current filename for display in footer
Dim AppFilenameVar As String
AppFilenameVar = Left(CurrentProject.Name, Len(CurrentProject.Name) - 6)
Exit Sub
ExitHandler:
Me.Painting = True 'To ensure painting is turned back on even with an error
Exit Sub
ErrHandler:
Call ErrProcessor
Resume ExitHandler
End Sub
The Load Code is using Application UI hiding from @isladogs