How to always persist PixelsPerInch = 96 in DFM files even if Windows use medium font size (125%)
Asked Answered
G

1

11

I set my Windows 7 font size to medium (125%). When I open a form Delphi XE2 IDE, the PixelsPerInch in DFM files always set to 120 automatically. Using smaller font size in Windows (100%) makes PixelsPerInch to 96 in Delphi DFM files.

This create a problem when coding in team environment. Most team members use smaller font size (100% or 96 PPI). All DFM files store in version control repository is using 96 PPI. If I commit my DFM files that use 120 PPI to repository, all others team members will confuse about what I have changed to the DFM files. All properties related to size, width or height will be changed.

Is that possible to force Delphi IDE to save the DFM in 96 PPI when working with 120 PPI windows environment?

Greening answered 19/6, 2012 at 8:54 Comment(16)
Our team's solution is that every developer that touches .dfm files uses small fontsQuarters
That would require a logout from Windows when changing the Windows font size. Is there any better solution like start Delphi in 96 PPI even if Windows is large font?Greening
If there is another way, I haven't found it.Quarters
nice question, I have the same problem with 120dpi fontsAlcohol
You might want to read the article by Zarko Gajic, Multi-Resolution Delphi Applications. There is source code to test a form with different screen resolutions. Might be worth a test. Personally I always set the Scaled property of a form to false.Polygamy
@LURD Setting Scaled to false means that your app will be unusable on high dpi displays.Quarters
@DavidHeffernan, is there a way to calculate the breaking point ? I always use 1920x1200 (or higher) and medium size font when developing. I haven't seen any form to misbehave yet. On the other hand I have seen lots of delphi applications to fail when used on systems with medium/large fonts when the scaled property is true. Most common error is in dialogs with ok/cancel buttons hidden.Polygamy
@LURD That's because the devs of those apps don't know what they are doing. It's not too hard to write a Delphi app that scales perfectly to any level. For example, I've tested my app at 200% font scaling.Quarters
@DavidHeffernan: It would be a problem if your team members using mix windows font sizes. The version control repository would be hard to follow as mix commits of various PixelsPerInch setting cause lot of changes to form controls propertiesGreening
@ChauCheeYang I fully understand the issue. It is for exactly the reasons you describe that my team of developers all develop with small fonts, i.e. 96dpi.Quarters
+1 and Favorite, our team is still desperately awaiting a solution for our software which consists of over 300 forms.Zita
@JerryDodge: Perhaps use Delphi IDE ToolsAPI to write a plugin to play with TForm.Scaled may help.Greening
@ChauCheeYang I actually considered modifying the TApplication / TForm to automatically set the scale of each form all at once, rather than one by one.Zita
@JerryDodge: I think what David Heffernan proposed is the way to go. By choosing a fixed PixelsPerInch among team members. If we can find a way to save DFM files to a fixed PixelsPerInch even working in different windows font size, then the problem is solved.Greening
I have report the issue to QC#106547Greening
I have wrote a Delphi IDE open tools to tweak the the form designer in Delphi IDE. Please check an answer from the post.Greening
G
4

I have wrote a Delphi IDE open tools to tweak the the form designer in Delphi IDE. The tool attempt to let user design form in fixed scale of stored PixelPerInch in form regardless of Windows font size. It prevent the form designer to scale the form to Windows font size. The original PixelsPerInch property should maintain when saving the changes of forms.

The code has submitted to Embarcadero Code Central: 28922.

Greening answered 21/6, 2012 at 6:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.