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?

Chau Chee Yang
  • 18,422
  • 16
  • 68
  • 132
  • Our team's solution is that every developer that touches .dfm files uses small fonts – David Heffernan Jun 19 '12 at 08:57
  • 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? – Chau Chee Yang Jun 19 '12 at 09:01
  • If there is another way, I haven't found it. – David Heffernan Jun 19 '12 at 09:35
  • 1
    nice question, I have the same problem with 120dpi fonts – teran Jun 19 '12 at 10:15
  • You might want to read the article by Zarko Gajic, [Multi-Resolution Delphi Applications](http://delphi.about.com/od/standards/a/aa030700a.htm). 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`. – LU RD Jun 19 '12 at 11:38
  • @LURD Setting Scaled to false means that your app will be unusable on high dpi displays. – David Heffernan Jun 19 '12 at 11:49
  • @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. – LU RD Jun 19 '12 at 12:00
  • @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. – David Heffernan Jun 19 '12 at 12:06
  • @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 properties – Chau Chee Yang Jun 19 '12 at 12:21
  • @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. – David Heffernan Jun 19 '12 at 12:29
  • +1 and Favorite, our team is still desperately awaiting a solution for our software which consists of over 300 forms. – Jerry Dodge Jun 19 '12 at 23:30
  • @JerryDodge: Perhaps use Delphi IDE ToolsAPI to write a plugin to play with TForm.Scaled may help. – Chau Chee Yang Jun 20 '12 at 00:41
  • @ChauCheeYang I actually considered modifying the `TApplication` / `TForm` to automatically set the scale of each form all at once, rather than one by one. – Jerry Dodge Jun 20 '12 at 00:45
  • @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. – Chau Chee Yang Jun 20 '12 at 01:54
  • I have report the issue to [QC#106547](http://qc.embarcadero.com/wc/qcmain.aspx?d=106547) – Chau Chee Yang Jun 20 '12 at 06:08
  • I have wrote a Delphi IDE open tools to tweak the the form designer in Delphi IDE. Please check an answer from the post. – Chau Chee Yang Jun 21 '12 at 06:35

1 Answers1

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.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Chau Chee Yang
  • 18,422
  • 16
  • 68
  • 132