Imaginsystems


Tecniche di Programmazione - Codici Sorgenti - News Informatiche
Archivio Posts
Anno 2014

Anno 2013

Anno 2012
Statistiche
  • Views Home Page: 71.612
  • Views Posts: 542.423
  • Views Gallerie: 0
  • n° Posts: 210
  • n° Commenti: 224

VB.NET - FUNZIONE COME CENTRARE IL FORUM O FINESTRA (DA CODICE)

VB.NET - Funzione che centra una finestra Frame al centro del Desktop (Codice)


  

Oggi vi voglio mettere a disposizione una funzione, che serve a Posizionare la finestra al centro del Desktop.

CODICE VISUAL STUDIO 2010 - VISUAL BASIC .NET - VB.NET:

'Funzione che mette al centro del Desktop la vostra Finestra o Form
Public Sub CentraForm()
        Me.Left = (Screen.PrimaryScreen.Bounds.Width - Me.Width) / 2
        Me.Top = (Screen.PrimaryScreen.Bounds.Height - Me.Height) / 2
End Sub

Alternativa di soluzione, secondo metodo :

CODICE VISUAL STUDIO 2010 - VISUAL BASIC .NET - VB.NET:

'Funzione che mette al centro del Desktop la vostra Finestra o Form
Public Sub CentraFormDesktop()
        Dim currentArea = Screen.FromControl(Me).WorkingArea
        Me.Top = currentArea.Top + CInt((currentArea.Height / 2) - (Me.Height / 2))
        Me.Left = currentArea.Left + CInt((currentArea.Width / 2) - (Me.Width / 2))
End Sub

By ImaginSystems & Queen Gin   
Categoria: VB.NET
giovedì, 06 set 2012 Ore. 10.06

Messaggi collegati


Ora e Data
Mappa
Blogs Amici
    Copyright © 2002-2007 - Blogs 2.0
    dotNetHell.it | Home Page Blogs
    ASP.NET 2.0 Windows 2003