by Waterfall (4 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Sun 12th December 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Center a control (button, textbox, ...) on a form.
API Declarations
'CenterCtrlX Form1.Command1
'// and / or
'CenterCtrlY Form1.Command1
Ctrl.Left = (Me.ScaleWidth - Ctrl.Width) / 2
End Sub
Private Sub CenterCtrlY(Ctrl As Control)
Ctrl.Top = (Me.ScaleHeight - Ctrl.Height) / 2
End Sub