- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我通过设置 <dpiAware>True/PM</dpiAware>
让我的应用程序在每台显示器上都能感知 dpi在 list 文件中。我可以使用进程资源管理器验证这确实有效,或者通过调用 GetProcessDpiAwareness。
这一切都很好,我可以在我的代码中很好地扩展客户区域中的任何内容。但是,我唯一的问题是,如果我将应用程序从系统 dpi 监视器拖到非系统 dpi 监视器,标题栏和任何系统菜单要么变得太大,要么太小。对于大多数内置应用程序(例如 calc、edge browser 等)来说,情况并非如此,因此必须有足够的空间来正确缩放它。有人知道 MS 的开发人员是如何做到这一点的吗?
下面的截图应该能更好地解释我的问题。另请注意,在缩放 (96dpi) 时,关闭、最小和最大按钮之间的填充是不同的。
Sample app我正在附加一个非常简单的应用程序,它可以感知每个显示器的 dpi。
最佳答案
Windows 10 周年更新 (v1607) 添加了一个新的 API,您必须调用它才能启用非客户端区域的 DPI 缩放:EnableNonClientDpiScaling
.这个函数应该被调用,当WM_NCCREATE
收到。消息在窗口创建期间被发送到窗口的过程回调。
例子:
case WM_NCCREATE:
{
if (!EnableNonClientDpiScaling(hWnd))
{
// Error handling
return FALSE;
}
return DefWindowProcW(...);
}
如果应用程序的 DPI 感知上下文是 DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
,则应省略调用 EnableNonClientDpiScaling
,因为它不会有任何效果,尽管该函数仍会成功返回.
来自 the documentation :
Non-client scaling for top-level windows is not enabled by default. You must call this API to enable it for each individual top-level window for which you wish to have the non-client area scale automatically. Once you do, there is no way to disable it. Enabling non-client scaling means that all the areas drawn by the system for the window will automatically scale in response to DPI changes on the window. That includes areas like the caption bar, the scrollbars, and the menu bar. You want to call
EnableNonClientDpiScaling
when you want the operating system to be responsible for rendering these areas automatically at the correct size based on the API of the monitor.
见 this blog post有关 Windows 10 AU 中 DPI 缩放更改的更多信息。
关于c++ - 如何在 DPI 感知 win 应用程序上缩放标题栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31781767/
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 7 年前。 Improve th
所以我正在开发一个黑 jack 程序,但我有点卡住了。我会警告大家,我对编程真的很陌生,而且,我正在项目中期......所以有一些松散的结局和未使用的变量,以及一些不必要的逻辑(用于测试),但这就是我
我正在尝试创建一个可用作 OpenGL 测试工具的示例程序。到目前为止,我的那个似乎可以工作,但似乎忽略了通过统一变量 MVPMatrix 传递的 MVP 矩阵。当我添加代码以读回制服并检查它是否确实
感谢您帮助我,这是有关我的代码的部分。 printf("Thank you, now please enter the logic gate"); scanf("%s", &C); if (C ==
public static void ejemplosString(String palabra){ char[] letras = palabra.toCharArray();
所以,我有一个 php 应用程序,通过 cgi 和 nginx 运行。我有一个 .jar 程序,用于在条形码打印机(Zebra)上打印条形码,猜猜看是什么!。 我的 php 应用程序使用 exec()
我遇到的唯一问题是 getAll() 方法,它似乎在 PersonnelController 类中的位置立即运行。我也曾在其他很多地方尝试过,但都没有成功。 setAll() 方法看起来不错,我已经测
我是一名优秀的程序员,十分优秀!