by Ali Atiq (5 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Fri 9th August 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
common code for several forms to set position like Left, Top, Width, Height and windowstate
API Declarations
Public Sub GetFormSetting(f As Form)
Dim fLeft$, fTop$, fWidth$, fHeight$, WinState%
WinState% = GetSetting(App.EXEName, f.Name, "WindoState", 0)
If WinState% > vbNormal Then
f.WindowState = WinState%
Else
fLeft$ = GetSetting(App.EXEName, f.Name, "Left", 100)
fTop$ = GetSetting(App.EXEName, f.Name, "Top", 100)
fWidth$ = GetSetting(App.EXEName, f.Name, "Width", 100)
fHeight$ = GetSetting(App.EXEName, f.Name, "Height", 100)
f.Left = fLeft$
f.Top = fTop$
f.Width = fWidth$
f.Height = fHeight$
End If
End Sub
Public Sub SaveFoemSetting(f As Form)
SaveSetting App.EXEName, f.Name, "Left", f.Left
SaveSetting App.EXEName, f.Name, "Top", f.Top
SaveSetting App.EXEName, f.Name, "Width", f.Width
SaveSetting App.EXEName, f.Name, "Height", f.Height
If f.WindowState <> vbMinimized Then
SaveSetting App.EXEName, f.Name, "WindoState", f.WindowState
End If
End Sub
Private Sub Form_Load()
GetFormSetting Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
SaveFoemSetting Me
End Sub
No comments have been posted about common code for several forms to set position like Left, Top, Width, Height and windowstate. Why not be the first to post a comment about common code for several forms to set position like Left, Top, Width, Height and windowstate.