Problems Using Delphi 5 Forms with Vista

I have developed code with Delphi 5 for a long time. However, with Vista 64, the main forms (the user interface) do not display correctly .. and, in fact, are unusable .. when the Delphi defaults are used.

It is my opinion that this is an intentional move by Microsoft to make all existing software non-functional. (There is no way that this is simply some accident. If it was, it would have been fixed in service pack 2.)

I have written several totally trivial programs to demonstrate the problem. They are located in the zip file. Basically, the forms contain 3 buttons

The form size is fairly small (250x150) so that screen captures can be displayed at full size.

One button saves a jpeg of the form image .. just to simplify creating this help page.

Basics | Examples | Comment | References


Basics

In order to get the forms to work in Vista, 3 properties must be changed. If you really want AutoScroll to be true (I do), set it in FormCreate .. at that point, the damage is already done (I mean - prevented).


Examples

This is just a basic form with 3 buttons - Form_Test.exe. Form2_Test.exe is identical to Form_Test.exe except for 2 edit fields and some code to load the fields and set the form size.


Comment

Most of the help I have found online indicates how to make your Windows XP applications look like they were designed for Vista. What I want is for my application to look the same on every Windows platform.

What kind of an idiot spends time designing something and then wants someone else to change how it looks. It is like having some museum changing the color of the flowers in a painting .. or changing a seascape to a mountain valley. Sorry .. I consider that to be vandalism and a despicable copyright violation.

In fact, this is probably a design error in Vista. The compatibility options should have worked. (Of course, I tried all the Vista compatibility settings .. and many different combinations. I never saw any difference. None at all.) However, the fact that this problem has been there for a number of years indicates that it might be intentional.

On the other hand, it is pretty apparent that the Delphi 5 VCL contains a design error .. the scaling should have worked.

Another source of trouble is TForm.Constraints - a set of 4 properties that can be used to control the minimum and maximum width and height of your forms. (Vista - the OS that keeps on giving.) (Thanks to a reader - include an email address if you want a response.)


References

Make the text on your screen larger or smaller
How to use the Windows 7 dpi setting to change the application size. (I simply assume that Vista is similar since I see similar dialog boxes.)

Near the bottom, this explains how to enable the Windows XP style DPI scaling. On my system, the check box was checked .. but also greyed out.

MS Sans Serif font is bigger
"In windows 7, the [MS Sans Serif] font is bigger, and it results missing characters in cells and missing rows on the program tables." August 8, 2010

The only response describes a registry hack - however, it is not acceptable for me to tell people to hack the registry to run my code. This is also where I got the previous link.

Microsoft Sans Serif
This indicates that MS Sans Serif is a bit mapped font and that Microsoft Sans Serif is "metrically compatible" (whatever that may mean)

Put MS Sans Serif back in to your menus
"While you may select any other font in the display properties for pull down menus, if you select MS Sans Serif MS Office and other recent MS applications will automatically replace your selection with Tahoma."

This helped me discover that Microsoft treats MS Sans Serif differently from all other fonts. Specifically, in buttons, the application always displayed the same font size regardless of what I did. When I selected Arial, my font size changes had an effect. This reference indicated that the font name was causing the problem.

From the provided examples, the difference between Tahoma and MS Sans Serif is the size of the dots in the ellipses. In fact, that is the only obvious difference. (There are numerous other differences, but at 8 points they are not so obvious.)

Fonts for the Web
This provides examples and descriptions of many common fonts. However, it incorrectly indicates that Tahoma is a monospaced font.

How to deal with form size issues from Delphi 6 and WinXP to Delphi 2007 and Vista/Win7
This had the real answer


Author: Robert Clemenzi
URL: http:// mc-computing.com / Languages / Delphi / VistaForms / Delphi_5_Forms.html