Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Shared Function GetDpiAdjustedMargins(ByVal WindowHandle As IntPtr, ByVal Left As Integer, ByVal Right As Integer, ByVal Top As Integer, ByVal Bottom As Integer) As Margins
- '
- Dim Graphics As System.Drawing.Graphics = System.Drawing.Graphics.FromHwnd(WindowHandle)
- Dim DesktopDPIx As Single = Graphics.DpiX
- Dim DesktopDPIy As Single = Graphics.DpiY
- Dim Margins As Margins = New Margins
- Margins.Left = Left * (DesktopDPIx / 96)
- Margins.Right = Right * (DesktopDPIx / 96)
- Margins.Top = Top * (DesktopDPIx / 96)
- Margins.Bottom = Bottom * (DesktopDPIx / 96)
- Return Margins
- '
- End Function
Add Comment
Please, Sign In to add comment