You are here:
  • CDN
  • »
  • Threads

Creating Delphi Applications for Windows Vista

Daniel England on 06-Nov-06 21:34:

Hmmm.... I have a bit of an issue with descibing changing the font name as good practice. Shouldn't the API be used to fetch the font details? So far as I can tell, Microsoft is using the system MessageFont for window controls. Example:

____procedure TSomeControl.Setup;

________var

________ncm: TNonClientMetrics;

________begin

//______...

________ncm.cbSize:= SizeOf(NonClientMetrics);

________if SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0,

________________@ncm, 0) then

____________Font.Handle:= CreateFontIndirect(ncm.lfMessageFont);

//______...

________end;

This seems to work now (for _all_ versions?) and I'd imagine it will work with Vista, too (although I _can't_ test that).

Additionally, list views and the like should use the IconFont but this is available from the Screen object instance.

Of course, its probably better to create this font somewhere and reusing it than creating it multiple times.

I wish the TScreen object had the MessageFont as a property and even more, that TForm used it! (SystemFont property??)

Daniel.

PS: Sorry about the underscores. Code looks _daft_ being inserted flush with the margin in a post and is _unreadable_. I couldn't see how to mark it as code!
0 Replies
Status: Unmoderated
New Reply
Copyright © 2006 by CodeGear Contact Us  |  Legal Notices  |  Privacy Statement