Einzelnen Beitrag anzeigen

Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#6

Re: System Fonts in ComboBox einlesen

  Alt 9. Jan 2006, 14:43
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;
Thomas
  Mit Zitat antworten Zitat