Einzelnen Beitrag anzeigen

Benutzerbild von bitsetter
bitsetter

Registriert seit: 17. Jan 2007
1.169 Beiträge
 
Turbo Delphi für Win32
 
#2

Re: Items in ComboBox mit verschiedenen Schriften

  Alt 11. Dez 2007, 10:19
Hallo,

versuche es mal so:
Delphi-Quellcode:
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
begin
   with Control as TCombobox do
  begin
    if Index< screen.Fonts.Count then
    begin
      Canvas.FillRect(Rect);
      canvas.Font.Name:= screen.Fonts.Strings[Index];
      Canvas.TextOut(rect.Left, rect.Top,screen.Fonts.Strings[Index]);
    end;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Combobox1.Items:= screen.Fonts;
  Combobox1.Style:= csOwnerDrawFixed;
end;
Gruß bitsetter
"Viele Wege führen nach Rom"
Wolfgang Mocker (geb. 1954), dt. Satiriker und Aphoristiker
  Mit Zitat antworten Zitat