![]() |
System Fonts in ComboBox einlesen
Hi@all,
ich möchte alle auf dem System befindlichen Fonts in eine ComboBox einlesen. Gibt es eine Methode, welche sich sämtliche Fonts besorgt? LG, Karsten |
Re: System Fonts in ComboBox einlesen
Hi,
unit Printers einbinden und über printer.fonts einlesen. Cu, Frank |
Re: System Fonts in ComboBox einlesen
Delphi-Quellcode:
sollte helfen.
ComboBox1.Items.Assign(Screen.Fonts);
|
Re: System Fonts in ComboBox einlesen
Ok sowiet war ich jetzt auch schon, danke,
habe da aber noch 2 Probleme, einmal wie bekomm ich nun die Schriftnamen in die ComboBox. Zur Info, bin gerade dabei mir ein eigenes Ctrl zu schreiben.
Delphi-Quellcode:
Wenn ich es so versuche bekomme ich eine Exception : Element hat kein übergeordnetes Fenster.
FPrinter := TPrinter.Create;
I := FPrinter.Fonts.Count; for A := 0 to I do Begin Items.Insert(A, FPrinter.Fonts.Text); End; Zweitens sollen die Schriftarten so dargestellt werden, das man sieht wie sie aussehen, wie in Word halt. Da ich Delphi Neuling bin steh ich gerade voll auf dem Schlauch :gruebel: Weiß halt noch nicht wie ich die So darstellen soll. |
Re: System Fonts in ComboBox einlesen
Ok Prob Nr. 1 hat sich erledigt einfach CreateWnd überschrieben und dort die Schriften eingefügt.
|
Re: System Fonts in ComboBox einlesen
Delphi-Quellcode:
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState); begin with TComboBox(Control) do begin Canvas.FillRect(rect); Canvas.Font.Style := [fsbold]; Canvas.Font.Name := Items[Index]; Canvas.TextOut(rect.Left, rect.Top, Items[Index]); end; end; procedure TForm1.FormCreate(Sender: TObject); begin { Den ComboBox Style noch im Objekt Inspector auf csOwnerDrawFixed setzen } ComboBox1.Items := Screen.Fonts; end; |
Re: System Fonts in ComboBox einlesen
Jau besten Dank, das hat wunderbar funktioniert!
Gibt es Jetzt auch noch die Möglichkeit, wie in Word, ein Icon angezeigt zu bekommen welches die Art der Schrift(TrueType etc); mit auszugeben? |
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:09 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz