Einzelnen Beitrag anzeigen

benst

Registriert seit: 20. Jun 2004
155 Beiträge
 
Delphi 5 Standard
 
#1

ListBox: Farbe von Makierungsumrandung ändern

  Alt 21. Aug 2007, 19:44
Hi,

ich habe in meinem Programm eine ListBox mit Text in unterschiedlichen Farben. Wenn ich Einträge anklicke, ist die Umrandung teilweise nicht schwarz (hängt von Farbe des Eintrags ab) - ich glaube es ist eine komplementäre Farbe.
Ich hätte aber gerne ausschließlich schwarze Umrandung. Wie kann ich das ändern?

Gruß
Ben
P.S.:Im Anhang findet ihr ein Bild und hier ein bisschen Code:

Delphi-Quellcode:
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
  var LB: TListBox;
begin
  LB := (control as TListBox);
    case Index of
      1: begin
         LB.Canvas.Brush.Color := clRed;
         LB.Canvas.Font.Color := clBlack;
         LB.Canvas.Pen.Color := clWhite;
         end;
      2: begin
         LB.Canvas.Brush.Color := clYellow;
         LB.Canvas.Font.Color := clBlack;
         LB.Canvas.Pen.Color := clWhite;
         end;
[...]
      else
        begin
        LB.Canvas.Brush.Color := clWhite;
        LB.Canvas.Font.Color := clBlack;
        end;
    end;
    LB.Canvas.Rectangle(Rect);
    LB.Canvas.TextOut(Rect.Left + 1, Rect.Top + 1, LB.Items[Index]);
end;
Miniaturansicht angehängter Grafiken
temp_151.png  
  Mit Zitat antworten Zitat