Delphi应用程序,表单大小在不同机器上有所不同
我有一个 Delphi 7 应用程序,在 WinXP 开发机器上,表单大小与设计的大小相同。
然而,在 Vista 机器上运行该应用程序时,某些表单被放大了 20-30%,在表单的右侧和底部边缘留下了大的空白区域。
在我们客户的一台 WinXP 计算机上,表单缩小了,导致表单上出现滚动条。
在大多数其他机器上,它显示正常。
该应用程序确实会记住某些表单上最后使用的表单大小,并在下次打开表单时使用它,但是即使删除这些设置,默认表单大小仍然与其设计方式不同。
有什么想法吗?
I've got a Delphi 7 app, on the WinXP development machine the form size is the same as it was designed.
However, running the app on a Vista machine, some forms have been enlarged 20-30%, leaving big blank spaces on the right and bottom edge of forms.
On one of our client's WinXP machine, the forms have shrink, causing scroll bars to show up on the forms.
On most other machines, it shows up OK.
The app does remember the form size that was last used on some forms, and uses it next time the form is opened, however even removing these settings, the default form size is still different to how it was designed.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这听起来像是Delphi 表单以及与系统字体大小交互的众所周知的问题< /a>.
Delphi 窗体的默认行为是尝试扩展以尊重(运行时)用户的桌面环境。然而,这可能会产生意想不到的不良副作用,并且您的“症状”听起来可能就是您的情况。
但一切并没有失去!可以将 Scaled 属性(默认情况下为 TRUE)设置为 FALSE 以防止出现这种情况,但我建议您阅读第一篇文章,并考虑 本文中的信息,以确定这是否是适合您情况的正确解决方案。
This sounds like 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, and your "symptoms" sound like this could be what's going on in your case.
But all is not lost! 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.
Vista 机器上大字体与小字体的比较?
Large Fonts versus Small Fonts on the Vista machine maybe?
在每个表单的 OnCreate 事件中使用此代码:
如果 Win32Platform = VER_PLATFORM_WIN32_NT 那么
Font.Name := 'MS Shell Dlg 2'
别的
Font.Name := 'MS Shell Dlg';
Use this code in OnCreate event for every your form:
if Win32Platform = VER_PLATFORM_WIN32_NT then
Font.Name := 'MS Shell Dlg 2'
else
Font.Name := 'MS Shell Dlg';