我目前正在运行
Private Sub GetInches()
Dim searcher As New ManagementObjectSearcher( _
"\root\WMI", _
"SELECT * FROM WmiMonitorBasicDisplayParams")
For Each queryObj As ManagementObject In searcher.Get()
Dim width As Double = CByte(queryObj("MaxHorizontalImageSize")) / 2.54
Dim height As Double = CByte(queryObj("MaxVerticalImageSize")) / 2.54
Dim diagonal As Double = Decimal.Round(Math.Sqrt(width * width + height * height), 1, MidpointRounding.ToEven)
tbVGARES.Text = diagonal
Next
searcher.Dispose()
End Sub
但是当我在几台笔记本电脑上运行它时,有时候英寸会关闭。
1个屏幕显示15.5"屏幕是15.6" 其他屏幕显示14"屏幕是13.7" 等
也许有人知道解决这个问题的方法? 笔记本电脑上标准尺寸的液晶屏是:
10,1" 11,6" 12,0" 12,1" 13" 13,3" 14" 14,1" 15" 15,4" 15,6" 16" 16,4" 17,1" 17,3" 18,4"
答案 0 :(得分:0)
我认为以下内容应该有效:
For Each scr In Screen.AllScreens
Dim width = scr.Bounds.Width / Me.CreateGraphics.DpiX
Dim height = scr.Bounds.Height / Me.CreateGraphics.DpiY
Dim size = Math.Sqrt((width * width) + (height * height))
Debug.WriteLine(String.Format("Screen {0} is Size {1:0.00} inches", scr.DeviceName, size))
Next