(CodeLib-Manager)
Registriert seit: 10. Jun 2002
4.648 Beiträge
Delphi XE Professional
|
Re: Listbox färbt komisch ein
25. Sep 2008, 21:48
Delphi-Quellcode:
procedure TForm1.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.FillRect(Rect);
Canvas.Brush.Color := clRed;
Canvas.Pen.Color := clWhite;
end
else
begin
//falls gewünscht
Canvas.FillRect(Rect);
Canvas.Brush.Color := clWhite;
Canvas.Pen.Color := clBlack;
end;
Canvas.Font.Color := clWindowText; // <- diese Zeile noch hinzufügen. Dann ist die Schrift nicht mehr "weiss"
Canvas.TextRect(Rect, Rect.Left + 1, Rect.Top + 1, Items[Index]);
end;
end;
Thomas
|
|
Zitat
|