1
votes

Is there a way to change the default Font for all of the Components on a Form?

In win8, the default "MS Sans Serif" looks thin and washed out. There is a new Font shown just above it in the list and I assume MSoft added it for win8 for some reason. It is called "Microsoft Sans Serif" and is a much cleaner and lightly Bold-ed Font.

I used this link to change the default for Forms, thinking (hoping) that all components would use the Parent-Font, but sadly, no. The only thing that Registry tweak changed was the Title Font for the Form. The body of the Form and thus the components on it are still using the skinny old "MS Sans Serif."

Is there some way to force all components to use the newer Font, other than changing the Form's body-Font every time?

1
For Windows 8? Nah. Microsoft Sans Serif, the TrueType font, was added in Windows 2000, and actually isn't distributed with Windows 8.Rob Kennedy
Follow Ken's link and read my answer there. In summary, set Application.DefaultFont.David Heffernan
DefaultFont is not available in Delphi 5, which he indicates he is using in his Subject line.MikeD
Are you sure the registry setting didn't work? Create a new form and see what font it uses. Perhaps the setting only applies to new forms, which haven't had their fonts set already. For old forms, can't you just set the Font property? It should automatically apply to all the other controls, too, except for the ones where ParentFont is false.Rob Kennedy

1 Answers

1
votes

Delphi 5 has no support for the DefaultFont property.

You could work around it by setting the ParentFont property of all your forms and controls to true.

With or without DefaultFont: all fonts in your application (especially Name, Height, and Style) would have to be the same to make this work.

An alternative way to approach your problem is by writing a method that recursively visits all controls, and replaces the Name property of Fonts on Forms/Controls into the name of a font that is installed. This would work in all Delphi versions.

So the answer is yes you can.

Edit: example of how such a method could look like: Font consistency throughout Project?