...abwechselnd unterschiedliche Hintergrundfarben für Combobox Items anzeigen?
Autor: Manfred Hausen
procedure ComboColor(C: TWinControl; I : Integer; R : TRect; EColor, OColor, FColor : TColor);
begin
with (C as TCombobox) do //TCombobox oder T.....box
begin
if Odd(I) then Canvas.Brush.color := OColor
else Canvas.Brush.color := EColor;
Canvas.FillRect(R);
Canvas.Font.Color := FColor;
Canvas.TextOut(R.Left,R.Top,Items[I]);
end;
end;
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
ComboColor(Control, Index, Rect, clInfoBk, clWhite, clBlack);
end;
//Combobox.Style := csOwnerDrawFixed;
printed from
www.swissdelphicenter.ch
developers knowledge base