Advertisement
ASP_Volume3 Custom Controls/ Forms/ Menus #52135

Center a child form within a parent form

This function centers a child form within a parent form (not MDI), and can be used for custom messageboxes etc... Please try and leave a comment - Dan

AI

สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

ซอร์สโค้ด
original-source
Public Function CenterChild(Parent As Form, Child As Form)
On Local Error Resume Next
If Parent.WindowState = 1 Then
Exit Function
Else
Child.Left = (Parent.Left + (Parent.Width / 2)) - (Child.Width / 2)
Child.Top = (Parent.Top + (Parent.Height / 2)) - (Child.Height / 2)
End If
End Function
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine