C# API 获取系统DPI缩放倍数跟分辨率大小
2021-04-08 06:28
标签:https ext device 屏幕分辨率 ace names img imp desktop
C# API 获取系统DPI缩放倍数跟分辨率大小 标签:https ext device 屏幕分辨率 ace names img imp desktop 原文地址:https://www.cnblogs.com/lonelyxmas/p/9091152.htmlusing 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("gdi32.dll")]
static extern int GetDeviceCaps(
IntPtr hdc, // handle to DC
int nIndex // index of capability
);
[DllImport("user32.dll", EntryPoint = "ReleaseDC")]
static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDc);
#endregion
#region DeviceCaps常量
const int HORZRES = 8;
const int VERTRES = 10;
const int LOGPIXELSX = 88;
const int LOGPIXELSY = 90;
const int DESKTOPVERTRES = 117;
const int DESKTOPHORZRES = 118;
#endregion
#region 属性
///
文章标题:C# API 获取系统DPI缩放倍数跟分辨率大小
文章链接:http://soscw.com/index.php/essay/72755.html