TListView.onCustomDrawSubItem - How to draw the selected subitem? lazarus / 31-LCL ---------------------------------------------------------------------- zamtmn · 2013-09-01 19:08 Hi All! I'm trying to draw an subitem in the selected state. Code: [Select]          if (cdsSelected in state)or(cdsFocused in state) then           begin           Sender.canvas.Brush.Color:=clHighlight;           Sender.canvas.Font.Color:=clHighlightText;           end;           aRect:=Item.DisplayRectSubItem( SubItem,drBounds);           Sender.canvas.FillRect(aRect);           DefaultDraw:=false;When I select a row drawn all right, but if move mouse to my selected subitem and stop it for a split second. Ceases to be an element of the selection. Please tell me how. Example and screen attached ---------------------------------------------------------------------- howardpc · 2013-09-01 21:15 You could try this: Code: [Select]begin   if (subitem=2) and (Item.Focused or Item.Selected) then   begin     Sender.Canvas.Brush.Color:=clHighlight;     Sender.Canvas.Font.Color:=clHighlightText;     aRect:=Item.DisplayRectSubItem(SubItem, drBounds);     Sender.Canvas.FillRect(aRect);     DefaultDraw:=False;   end; end;  Presumably you also want to custom draw some text? However, drawing outside a Paint procedure is tricky. ---------------------------------------------------------------------- zamtmn · 2013-09-02 06:27 No, it is also wrong. result in attachment. As far as I understand, this is a bug. In Delphi cares about the background color inappropriately, it is set within VCL.