Center a form, relative to the available workspace
Centers a form, relative to the available workspace. This means that if your users have high, or wide taskbars, or other apps which restrict the workspace, your forms will still center properly.
AI
Shrnutí 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.
Zdrojový kód
Public Sub Center(ByRef frm As Form) 'Centers a form, relative to the available workspace Dim rt As RECT, result As Long Dim X As Single, Y As Single Dim oldScaleMode As Integer result = SystemParametersInfo(SPI_GETWORKAREA, 0&, rt, 0&) X = rt.Right - rt.Left Y = rt.Bottom - rt.Top X = X * Screen.TwipsPerPixelX Y = Y * Screen.TwipsPerPixelY X = X \ 2 - (frm.Width \ 2) Y = Y \ 2 - (frm.Height \ 2) oldScaleMode = frm.ScaleMode frm.ScaleMode = vbTwips frm.Move X, Y frm.ScaleMode = oldScaleMode End Sub Upload
Původní komentáře (3)
Obnoveno z Wayback Machine