2009-08-27 11 views

Odpowiedz

13

Można użyć:

My.Computer.Screen.Bounds 

czyli

Screen.PrimaryScreen.Bounds 

Bounds jest prostokątem, który zapewnia rozmiar. Alternatywnie możesz spojrzeć na WorkingArea, która nie będzie zawierać paska zadań i zadokowanych okien.

+0

Tak na prawym dolnym przykład, co czy może być? – Cyclone

+0

Nieważne, rozumiem! DZIĘKI! – Cyclone

0

dla WPF można użyć:

System.Windows.SystemParameters.PrimaryScreenWidth 

System.Windows.SystemParameters.PrimaryScreenHeight 
1

Można użyć coś takiego:

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

Wstaw ten kod na Form_Load. I umieścić kilka uchwał ...

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

rozważ dodanie objaśnienia do kodu – arghtype

0

dim wysokość jako liczba całkowita = Screen.PrimaryScreen.Bounds.Height dim jako szerokość całkowita = Screen.PrimaryScreen.Bounds.Width

Powiązane problemy