我是这样做的 procedure TsysForm.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); var ss:string; begin if odFocused in State then begin ListBox1.Canvas.Brush.Color:=clBlue; ListBox1.Canvas.FillRect(Rect); ListBox1.Canvas.Font.color:=clWhite; end else begin ListBox1.Canvas.Brush.Color:=clWhite; ListBox1.Canvas.FillRect(Rect); ListBox1.Canvas.Font.color:=clblack; end; if Selected[Index] then ss:='√'+ListBox1.Items[Index] else ss:=' '+ListBox1.Items[Index]; ListBox1.Canvas.textOut(Rect.Left+5,Rect.top+4,ss); end;
procedure TsysForm.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
ss:string;
begin
if odFocused in State then
begin
ListBox1.Canvas.Brush.Color:=clBlue;
ListBox1.Canvas.FillRect(Rect);
ListBox1.Canvas.Font.color:=clWhite;
end
else
begin
ListBox1.Canvas.Brush.Color:=clWhite;
ListBox1.Canvas.FillRect(Rect);
ListBox1.Canvas.Font.color:=clblack;
end;
if Selected[Index] then
ss:='√'+ListBox1.Items[Index]
else
ss:=' '+ListBox1.Items[Index];
ListBox1.Canvas.textOut(Rect.Left+5,Rect.top+4,ss);
end;