Thanks for that. I considered working out how to draw it myself but then thought Windows may still control the selection.
I'll need to do the same with OnCustomDrawSubitem. I have RowSelect set to true. I presume the item and subitems rectangles will join together in this case so there is one continuous selection. I'll have to have a play. Cheers, Ross. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeremy North Sent: Friday, 30 November 2007 3:23 a.m. To: NZ Borland Developers Group - Delphi List Subject: Re: [DUG] Listview selected highlight 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 <[EMAIL PROTECTED]> 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: [email protected] > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: > unsubscribe > _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe
