高DPI意识.我如何停止扩展??? [英] High DPI Awareness. How Do I Stop Scaling???

查看:167
本文介绍了高DPI意识.我如何停止扩展???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让我的应用程序了解DPI.我已经在Visual Studio的资源编辑器中创建了一个对话框.然后使用CreateDialog(),根据需要显示对话框.但是在高DPI分辨率下,控件,字体等会缩放,但对话框不会缩放.

基本上,我想停止对话框上控件的缩放.

我尝试了嵌入新清单的常规方法(如发布在MSDN上),并且还尝试使用SetProcessDPIAware()函数.尽管我对字体渲染有更多的控制权,但这两种方法仍然可以缩放控件.

我有一种感觉,我正在尝试执行Windows中不可能完成的事情.

I'm trying to get my Application to be DPI aware. I have created a dialog box in the resource editor in Visual studio. Then using CreateDialog(), It shows the dialog as desired. But on high DPI resolutions, the controls, fonts, etc scale but the dialog box does not.

Basically I want to stop the scaling of controls on my dialog. Is this even possible?

I tried the regular methods of embedding a new manifest (as posted on MSDN) and, as well, using the SetProcessDPIAware() function. Both approaches still scaled the controls, though I had more control over font rendering.

I have a feeling that I am trying to do something that is impossible in windows.

推荐答案

您将不得不放置该对话框以编程方式输出,因为对话框是基于系统字体构造的.系统字体将影响任何未直接指定字体的对话框. (然后,该字体将确定对话框的单位.)但是,框的宽度和高度不受此影响.我不希望您希望控件停止缩放...您希望框开始缩放以便控件适合它们.如果不这样做,则会遇到截断文本,间距问题等问题.

Win32 API函数GetDialogBaseUnits是您的朋友.

将此链接粘贴到文档资源管理器(VS2008中的帮助):

ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/winui/winui/windowsuserinterface/windowing/dialogboxes/对话框参考/对话框功能/getdialogbaseunits.htm
You will have to lay that dialog box out programmatically, as dialogs are constructed based on the system font. The system font will affect any dialog that does not specify a font directly. (Then, that font will determine the dialog units.)

The width and height of the box are not affected by this, however. I do not think you want the controls to stop scaling...you want the box to start scaling so that the controls will fit into them. If you do not do that, then you will have problems with cutoff text, spacing issues, etc.

The Win32 API function, GetDialogBaseUnits is your friend in this matter.

Paste this link into Document Explorer (Help in VS2008):

ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/getdialogbaseunits.htm


这篇关于高DPI意识.我如何停止扩展???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆