2009-08-27 25 views

risposta

13

È possibile utilizzare:

My.Computer.Screen.Bounds 

o:

Screen.PrimaryScreen.Bounds 

Bounds è un rettangolo che fornisce la dimensione. In alternativa, è possibile consultare WorkingArea, che non include la barra delle attività e le finestre ancorate.

+0

Così, per l'esempio in basso a destra, cosa sarebbe? – Cyclone

+0

Non importa, capito! GRAZIE! – Cyclone

0

per WPF è possibile utilizzare:

System.Windows.SystemParameters.PrimaryScreenWidth 

System.Windows.SystemParameters.PrimaryScreenHeight 
1

si può usare qualcosa di simile:

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

Inserire questo codice in Form_Load. Ho messo alcune risoluzioni ...

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

considera di aggiungere una spiegazione al tuo codice – arghtype

0

dim altezza intero = Screen.PrimaryScreen.Bounds.Height larghezza fioco come numero intero = Screen.PrimaryScreen.Bounds.Width

Problemi correlati