Imports System.Drawing Imports System.Runtime.InteropServices Public Class Screen Private Shared Function GetDeviceCaps(ByVal hdc As IntPtr, ByVal nIndex As Integer) As Integer End Function Public Enum DeviceCap VERTRES = 10 DESKTOPVERTRES = 117 End Enum Public Shared Function GetScalingFactor() As Single Dim g As Graphics = Graphics.FromHwnd(IntPtr.Zero) Dim desktop As IntPtr = g.GetHdc() Dim LogicalScreenHeight As Integer = GetDeviceCaps(desktop, CInt(DeviceCap.VERTRES)) Dim PhysicalScreenHeight As Integer = GetDeviceCaps(desktop, CInt(DeviceCap.DESKTOPVERTRES)) Dim ScreenScalingFactor As Single = CSng(PhysicalScreenHeight) / CSng(LogicalScreenHeight) Return ScreenScalingFactor End Function End Class