Berechnen der Screensize in cm durch Angabe der Bildschirmdiagonalen und des Seitenverhältnisses.
Aufruf:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim xw As Double
Dim yh As Double
Call GetScreenSize("21 4/3", xw, yh)
MessageBox.Show(xw & " " & yh)
End Sub
Public Sub GetScreenSize(ByVal monitor As String, ByRef xwidth As Double, ByRef yheight As Double)
Dim aspect_ratioX As Double
Dim aspect_ratioY As Double
Dim oblique_line As Double
Dim x As Double
Select Case monitor
Case "21 4/3"
aspect_ratioX = 4
aspect_ratioY = 3
oblique_line = 21
End Select
x = System.Math.Sqrt((oblique_line ^ 2) / (aspect_ratioX ^ 2 + aspect_ratioY ^ 2))
xwidth = aspect_ratioX * x * 2.54
yheight = aspect_ratioY * x * 2.54
End Sub
Kommentare zum Snippet