“VB.NET Center Form na tela” Respostas de código

VB.NET Center Form na tela

  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
Curious Cassowary

VB.NET Center Form na tela

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
Curious Cassowary

Respostas semelhantes a “VB.NET Center Form na tela”

Perguntas semelhantes a “VB.NET Center Form na tela”

Mais respostas relacionadas para “VB.NET Center Form na tela” em C#

Procure respostas de código populares por idioma

Procurar outros idiomas de código