简体   繁体   中英

Delphi apps, form size varies on different machines

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?

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机器上的大字体与小字体?

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';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM