Autor Beitrag
DELPHIn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 98

Windows Vista
Delphi 2007 für Win 32 Prof.
BeitragVerfasst: Do 08.01.04 17:16 
Hallo,

wie kann ich die Schriftart ermitteln, die gerade in Windows als Standart eingerichtet ist?
Ich habe schon gesucht aber nichts gefunden, das müsste doch aber möglich sein.

Danke

_________________
DELPHIn
=> Errare humanum est
DELPHIn Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 98

Windows Vista
Delphi 2007 für Win 32 Prof.
BeitragVerfasst: Do 08.01.04 17:31 
Ich hab es gefunden! Dabei hatte ich die Hoffnung gerade aufgegeben.
Hier der Code (ungetestet):
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
function GetMenuFont: TFont;
var
  ncm: TNonClientMetrics;
begin
  ncm.cbSize := SizeOf(TNonClientMetrics);
  SystemParametersInfo(SPI_GETNONCLIENTMETRICS, SizeOf(TNonClientMetrics), @ncm, 0);
  Result := TFont.Create;
  {
  lfCaptionFont - regular captions
  lfSmCaptionFont - small captions
  lfMenuFont - menus
  lfStatusFont - status bars
  lfMessageFont - message boxes
  }

  Result.Handle := CreateFontIndirect(ncm.lfCaptionFont);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  label1.Caption := GetMenuFont.Name;
end;


Moderiert von user profile iconPeter Lustig: Code- durch Delphi-Tags ersetzt

_________________
DELPHIn
=> Errare humanum est