Einzelnen Beitrag anzeigen

Tyrael Y.

Registriert seit: 28. Jul 2003
Ort: Stuttgart
1.093 Beiträge
 
Delphi 2007 Professional
 
#2

Re: Listbox färbt komisch ein

  Alt 25. Sep 2008, 15:39
So besser?


Delphi-Quellcode:
procedure Tmainform.ListBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
begin
  with (control as TListBox) do
  begin
    if Index = 2 then //bei best. Zeile soll folgendes gelten
    begin
      Canvas.Brush.Color := clRed;
      Canvas.Pen.Color := clWhite;
      Canvas.FillRect(Rect);
    end
    else
    begin
      //falls gewünscht
      Canvas.Brush.Color := clWhite;
      Canvas.Pen.Color := clBlack;
      Canvas.FillRect(Rect);
    end;
    Canvas.TextRect(Rect, Rect.Left + 1, Rect.Top + 1, Items[Index]);
  end;
end;
Levent Yildirim
Erzeugung von Icons aus Bildern:IconLev
  Mit Zitat antworten Zitat