Vb Net Center Form In Screen

[Solved] Vb Net Center Form In Screen | Vb - Code Explorer | yomemimo.com
Question : vb.net center form in screen

Answered by : turner-kindred

 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Me.Size = New System.Drawing.Size(400, 650) Me.CenterToScreen()
End Sub

Source : https://stackoverflow.com/questions/45934676/center-form-on-screen-during-runtime | Last Update : Wed, 29 Jul 20

Question : vb.net center form in screen

Answered by : turner-kindred

Public Shared Sub CenterForm(ByVal frm As Form, Optional ByVal parent As Form = Nothing) '' Note: call this from frm's Load event! Dim r As Rectangle If parent IsNot Nothing Then r = parent.RectangleToScreen(parent.ClientRectangle) Else r = Screen.FromPoint(frm.Location).WorkingArea End If Dim x = r.Left + (r.Width - frm.Width) \ 2 Dim y = r.Top + (r.Height - frm.Height) \ 2 frm.Location = New Point(x, y)
End Sub

Source : https://stackoverflow.com/questions/19392083/center-form-on-screen-or-on-parent | Last Update : Wed, 29 Jul 20

Answers related to vb net center form in screen

Code Explorer Popular Question For Vb