Собственно вопрос как сделать свою рамку выделения у listbox
Код:
procedure TMainApl.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
With (Control as TListBox) do begin
if odSelected in State then
if Index mod 2 = 0 then begin
DrawFocusRect((Control as TListBox).Canvas.Handle, Rect);
canvas.Pen.Width:=3;
canvas.Pen.Color:=clblue;
canvas.Brush.Color:=clred
end else begin
DrawFocusRect((Control as TListBox).Canvas.Handle, Rect);
canvas.Pen.Width:=3;
canvas.Pen.Color:=clblue;
canvas.Brush.Color:=clyellow;
end
else begin
canvas.Pen.Width:=0;
canvas.Pen.Color:=color;
canvas.Brush.Color:=color;
end;
canvas.FillRect(rect);
DrawText(Canvas.Handle, PChar(Items[Index]), Length(Items[Index]), Rect,
Control.DrawTextBiDiModeFlags(DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX));
end;
end;
но при этом мое выделение дйствует только на четных числах а нужно чтобы действовало на всех