c++中: int cxScreen,cyScreen; cxScreen=GetSystemMetrics(SM_CXSCREEN); cyScreen=GetSystemMetrics(SM_CYSCREEN); c#中: [DllImport("user32")] public static extern int GetSystemMetrics(int nIndex); //获取分辨率宽度 int x = GetSystemMetrics(0); //获取分辨路高度 int y…
原文:C# API 获取系统DPI缩放倍数跟分辨率大小 using System; using System.Drawing; using System.Runtime.InteropServices; namespace XYDES { public class PrimaryScreen { #region Win32 API [DllImport("user32.dll")] static extern IntPtr GetDC(IntPtr ptr); [DllImport(&…