listbox1.sytle:=lbOwnerDrawVariable;
在listbox1.OnDrawitem事件中写
procedure TForm1.DrawItem(Control: TWinControl;
Index: Integer;
Rect: TRect;
State: TOwnerDrawState);
begin
with ListBox1.Canvasdo
begin
if odSelected in State then
Brush.Color := clgreen;
FillRect(Rect);
TextOut(Rect.Left+1, Rect.Top+1, ListBox1.Items[Index]);
end;
end;