Dpi Aware

2019-07-22  本文已影响0人  雪之梦_8f14

设置

 <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <!--<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>-->
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
    </windowsSettings>
  </application>

获取虚拟屏幕的尺寸的三种方式

通过api获取

int left = GetSystemMetrics(SM_XVIRTUALSCREEN);
int top = GetSystemMetrics(SM_YVIRTUALSCREEN);
int width = GetSystemMetrics(SM_CXVIRTUALSCREEN);
int height = GetSystemMetrics(SM_CYVIRTUALSCREEN);

通过winform获取

int width3 = SystemInformation.VirtualScreen.Width;
int height3 = SystemInformation.VirtualScreen.Height;

通过wpf获取

double height1 = SystemParameters.VirtualScreenHeight;
double width1 = SystemParameters.VirtualScreenWidth;

上一篇 下一篇

猜你喜欢

热点阅读