title: Delphi: bug when resizing columns of List View (on DrawItem)
body: <p>Enable <strong>Autosize</strong> of columns and enable OwnerDraw for a List View. Then add a code below <a href="https://stackoverflow.com/questions/6617690/delphi-draw-selections-and-mouse-hover-effects-on-listviewdrawitem">from HERE</a>:</p>
  
  <pre><code>procedure TForm1.ListView1DrawItem(Sender: TCustomListView; Item: TListItem;
    Rect: TRect; State: TOwnerDrawState);
  var
    i: Integer;
    x1, x2: integer;
    r: TRect;
    S: string;
  const
    DT_ALIGN: array[TAlignment] of integer = (DT_LEFT, DT_RIGHT, DT_CENTER);
  begin
    if SameText(Item.SubItems[1], 'done') then
    begin
        Sender.Canvas.Font.Color := clWhite;
        Sender.Canvas.Brush.Color := clGreen;
    end
    else
      if Odd(Item.Index) then
      begin
        Sender.Canvas.Font.Color := clBlack;
        Sender.Canvas.Brush.Color := $F6F6F6;
      end
      else
      begin
        Sender.Canvas.Font.Color := clBlack;
        Sender.Canvas.Brush.Color := clWhite;
      end;
    if odSelected in State then                                                    // NEW!
    begin                                                                          // NEW!
      Sender.Canvas.Font.Color := clWhite;                                         // NEW!
      Sender.Canvas.Brush.Color := clNavy;                                         // NEW!
    end;                                                                           // NEW!
    Sender.Canvas.Brush.Style := bsSolid;
    Sender.Canvas.FillRect(Rect);
    x1 := 0;
    x2 := 0;
    r := Rect;
    Sender.Canvas.Brush.Style := bsClear;
    Sender.Canvas.Draw(3, r.Top + (r.Bottom - r.Top - bm.Height) div 2, bm);
    for i := 0 to ListView1.Columns.Count - 1 do
    begin
      inc(x2, ListView1.Columns[i].Width);
      r.Left := x1;
      r.Right := x2;
      if i = 0 then
      begin
        S := Item.Caption;
        r.Left := bm.Width + 6;
      end
      else
        S := Item.SubItems[i - 1];
      DrawText(Sender.Canvas.Handle,
        S,
        length(S),
        r,
        DT_SINGLELINE or DT_ALIGN[ListView1.Columns[i].Alignment] or
          DT_VCENTER or DT_END_ELLIPSIS);
      x1 := x2;
    end;
    if odFocused in State then                                                     // NEW!
      DrawFocusRect(Sender.Canvas.Handle, Rect);                                   // NEW!
  end;
  </code></pre>
  
  <p>Actively resize the <strong>penultimate</strong> column if it has autosize. It bill be bugs:</p>
  
  <p><img src="https://i.stack.imgur.com/Lt0vn.jpg" alt="enter image description here">
  <img src="https://i.stack.imgur.com/KIWeN.jpg" alt="enter image description here">
  <img src="https://i.stack.imgur.com/wugjY.jpg" alt="enter image description here">
  <img src="https://i.stack.imgur.com/9xkxL.jpg" alt="enter image description here"></p>
  
  <p>How to prevent these bugs?­­­­­­­­</p>
  
  <p>Thanks!</p>