|
|
Выравнивание всплывающей формы по центру текущей
Public Sub PoUpFormToCenter(sParentFormName$, sPoUpFormName$) ' es - 10.02.2024 v001
Dim lInsideWidth&, lInsideHeight&, lLeftNew&, lTopNew&
Const lFixTopPlus& = 2200
On Error GoTo PoUpFormToCenter_Err
If IsFormLoaded(sParentFormName) = False Then GoTo PoUpFormToCenter_End
If IsFormLoaded(sPoUpFormName) = False Then GoTo PoUpFormToCenter_End
With Forms(sPoUpFormName)
lInsideWidth = .InsideWidth
lInsideHeight = .InsideHeight
lLeftNew = Forms(sParentFormName).InsideWidth / 2 - lInsideWidth / 2
lTopNew = Forms(sParentFormName).InsideHeight / 2 - lInsideWidth / 2
lTopNew = lTopNew + lFixTopPlus
'Смеещение:
.Move lLeftNew, lTopNew ' Move (Left, Top, Width, Height)
End With
PoUpFormToCenter_End:
Exit Sub
PoUpFormToCenter_Err:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in Sub PoUpFormToCenter.", _
vbCritical, "Произошла ошибка!"
Err.Clear
Resume PoUpFormToCenter_End
End Sub
|
|