如何在 Delphi 7 应用程序中支持自定义桌面 DPI 设置?
我们有一些用 Delphi 7 编写的遗留应用程序。多年来,我们收到过一些要求在这些应用程序中支持自定义桌面 dpi 设置的请求,但我们一直能够回避问题,直到知道为止。好吧,我们不能再这样了。
当用户将桌面设置为 120dpi 时,某些控件会“脱离”应用程序或超出窗体的可见区域,特别是锚定到其父级右边缘的控件。
在不进行心脏直视手术的情况下,我能做些什么来预防这个问题呢?
We have a few legacy applications that were written in Delphi 7. We've had a few requests over the years to support custom desktop dpi settings in these applications but we have been able to dodge the bullet up till know. Well we can't anymore.
When users set their desktops to say 120dpi some of the controls "fall off" the application or stretches beyond the visible are of the form and specifically the ones that are anchored to the right edge of their parent.
What can I do to prevent this problem WITHOUT open heart surgery.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能知道,这是一个 Delphi 表单和交互的众所周知的问题与系统字体大小。
Delphi 窗体的默认行为是尝试扩展以尊重(运行时)用户的桌面环境。然而,正如您所发现的,这可能会产生意想不到的副作用。
但是 Scaled 属性(默认情况下为 TRUE)可以设置为 FALSE 以防止出现这种情况,但我建议您阅读第一篇文章,并考虑 本文中的信息,以确定这是否是适合您情况的正确解决方案。
如果您幸运的话,只需在所有表格上将“Scaled”设置为“FALSE”,即使不是一路顺利(这可能很乏味,但并不完全是心脏直视手术),也可能会帮助您实现这一目标。
As you probably know, this is a well known issue with Delphi forms and interactions with system font sizes.
The default behaviour of a Delphi form is to attempt to scale to respect the (runtime) user's desktop environment. This can have unintended and undesirable side effects however, as you have found.
But the Scaled property (TRUE by default) can be set FALSE to prevent this, but I recommend you read that first article, and also consider the information in this article in order to determine whether this is the right solution in your case.
If you're lucky, simply setting Scaled to FALSE on all your forms may get you a good way there, if not all the way (which may be tedious, but is not exactly open-heart surgery).