[DUG] Listview selected highlight

Jeremy North jeremy.north at gmail.com
Fri Nov 30 03:23:21 NZDT 2007


Just do all the drawing yourself.

ie:

procedure TForm19.ListView1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState;
  var DefaultDraw: Boolean);
var
  lRect: TRect;
  lFlags: Cardinal;
begin
  lRect := Item.DisplayRect(drLabel);
  ListView1.Canvas.Brush.Style := bsSolid;
  ListView1.Canvas.Brush.Color := clYellow;
  ListView1.Canvas.FillRect(lRect);
  ListView1.Canvas.Font.Color := clRed;
  lFlags := DT_SINGLELINE or DT_CENTER or DT_VCENTER;
  DrawText(ListView1.Canvas.Handle, PChar(Item.Caption),
Length(Item.Caption), lRect, lFlags);
  DefaultDraw := False;
end;


On Nov 29, 2007 9:32 PM, Ross Levis <ross at stationplaylist.com> wrote:
>
>
>
> Anyone know if it's possible to prevent a listview from showing the selected
> highlight colour on selected items?
>
>
>
> I want to display a specific brush colour depending on the type of item,
> which I do with OnCustomDrawItem, but the colour only displays when I move
> the focus away from the listview.  It goes back to the usual blue colour
> when the listview gets the focus again.
>
>
>
> I'm trying to find a Windows parameter to use in CreateParams, or even
> modify the ComCtrls unit if necessary, but I can't a way to do it.
>
>
>
> Thanks,
>
> Ross.
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
> unsubscribe
>


More information about the Delphi mailing list