Einzelnen Beitrag anzeigen

sebastian1979

Registriert seit: 22. Jan 2010
Ort: Solingen
16 Beiträge
 
Delphi 2005 Professional
 
#6

Re: Verschiedene Farben einzelner Items in ComboBox

  Alt 30. Jan 2010, 11:09
Vielen Dank für Eure Hilfe, vor allem für den INDEX
habe es jetzt wie folgt hinbekommen:

Delphi-Quellcode:
procedure TMHauptmaske.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
var holdColor: TColor;
begin
  holdColor := combobox1.Canvas.Brush.Color;
  if combobox1.Items.Strings[index] = 'test1then
  combobox1.canvas.Brush.Color := clred;
  if combobox1.Items.Strings[index] = 'test2then
  combobox1.canvas.Brush.Color := clyellow;
  if combobox1.Items.Strings[index] = 'test3then
  combobox1.canvas.Brush.Color := clgreen;
  combobox1.canvas.Font.Color := clblack;
  combobox1.Canvas.FillRect(rect);
  combobox1.Canvas.TextOut(Rect.left, Rect.top, combobox1.Items[index]);
  combobox1.canvas.brush.Color := holdColor;
end;
  Mit Zitat antworten Zitat