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.

I developed the mcVistaSucks component which helps to solve these problems.

This page documents the results of various configurations. In theory, there are 4 important boolean (true/false) parameters, yielding 16 combinations. However, since form.AutoScroll is always false (it must be for the application to display in Vista), only 8 testcases are necessary.

I have written one totally trivial program to demonstrate the problem. (It is identical to Button3_Anchored.exe .. with only the mcVistaSucks component added.) The only difference in the various *.exe files is the setting of the parameters. The executables 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.

Basics | Examples | Comment | References


Basics

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


Examples

This is just a basic form with 3 buttons. The original form is Button3_Anchored.exe. All the other forms contain a mcVistaSucks component with various parameters set. All 9 programs display exactly the same under Windows XP.

However, Vista is a different story. By default, the component makes the application render the same size in both XP and Vista. In fact, all the settings render the application at approximately the same size in both operating systems except when

This is by design - both properties must be true for the scaling to occur.

The automatic appearance of the scrollbars was tested for every *.exe file by manually resizing the forms. In all cases, they appear on both operating systems when mcVistaSucks1.Autoscroll is true, but not when it is false.

Note that the font in the title bar is different.


Comment

The component is a complete success .. but only for the form it is placed on.

As a future enhancement, I might add a property that allows the component to automatically modify all the forms in a project. However, I am not sure how it would work with dynamic forms that are created as needed .. such as mcTearOff_Windows. (Actually, those already look ok .. so maybe they don't need a fix.)

I might add properties to control the title bar and menu fonts .. since they have a similar problem. However, until I modify a program that uses menus, there is no rush.


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