2009-08-27 4 views

Répondre

13

Vous pouvez utiliser:

My.Computer.Screen.Bounds 

ou:

Screen.PrimaryScreen.Bounds 

Bounds est un rectangle qui fournit la taille. Alternativement, vous pouvez regarder le WorkingArea, qui n'inclura pas la barre des tâches et les fenêtres ancrées.

+0

Pour l'exemple en bas à droite, ce serait-ce? – Cyclone

+0

Nevermind, c'est compris! MERCI! – Cyclone

0

Pour WPF, vous pouvez utiliser:

System.Windows.SystemParameters.PrimaryScreenWidth 

System.Windows.SystemParameters.PrimaryScreenHeight 
1

Vous pouvez utiliser quelque chose comme:

My.Computer.Screen.Bounds.Size.Width 
My.Computer.Screen.Bounds.Size.Height 
-1

Insérer ce code dans form_load. Je mets des résolutions ...

Dim dw As Double 
    Dim dh as Double 


    Width = Screen.PrimaryScreen.Bounds.Width 
    If (Width = 1366) Then 
     dw = 1 
    ElseIf (Width = 1920) Then 
     dw = 1.4055 
    ElseIf (Width = 1280) Then 
     dw = 0.9379 
    End If 

    For Each c As Control In Me.Controls 
     c.Width = CInt(CDbl(c.Width * dw)) 
    Next 

    Height = My.Computer.Screen.Bounds.Size.Height 
    If (Height = 768) Then 
     dh = 1 
    ElseIf (Height = 1080) Then 
     dh = 1.4062 
    ElseIf (Height = 1024) Then 
     dh = 1.3333 
    End If 

    For Each g As Control In Me.Controls 
     g.Height = CInt(CDbl(g.Height * dh)) 
    Next 
+0

pensez à ajouter une explication à votre code – arghtype

0

hauteur faible comme nombre entier = Screen.PrimaryScreen.Bounds.Height largeur faible comme nombre entier = Screen.PrimaryScreen.Bounds.Width

Questions connexes