Einzelnen Beitrag anzeigen

Benutzerbild von roga
roga

Registriert seit: 15. Jun 2008
Ort: Sachsen-Anhalt
109 Beiträge
 
Delphi XE8 Professional
 
#8

Re: schriftstile in einer Combobox

  Alt 16. Sep 2008, 19:43
Hallo,

ein kleines Beispiel als Anregung:

Delphi-Quellcode:
procedure TFormEditor.ComboLetterDrawItem(Control: TWinControl;
  Index: Integer; Rect: TRect; State: TOwnerDrawState);
begin
  with ComboLetter.Canvas do
  begin
    FillRect(Rect);
    Font.Name := ComboLetter.Items[Index];
    Font.Size := 10;
    TextOut(Rect.Left + 1, Rect.Top, ComboLetter.Items[Index]);
  end;
end;

procedure TFormLetterEditor.ComboLetterMeasureItem(Control: TWinControl;
  Index: Integer; var Height: Integer);
begin
  if Index = -1 then exit;
  with ComboLetter.Canvas do
  begin
    Font.Name := ComboLetter.Items[Index];
    Font.Size := 10;
    Height := TextHeight('Xx') + 2;
  end;
end;
In den Eigenschaften muss Style auf csOwnerDrawVariable stehen!

Gruß RoGa
Ronald
  Mit Zitat antworten Zitat