Board index » delphi » Owner Draw ListView Repaint on Column Resize

Owner Draw ListView Repaint on Column Resize

I am using an owner draw listview control and it is working well except that
when in the report view and the columns are resized the control doesn't
repaint.  There isn't an OnColumnResize event and all of the other column or
mouse events don't fire when a column is resized so I can't call invalidate
there.  Can somebody help me?  Thanks a lot.

Jake Anderson

 

Re:Owner Draw ListView Repaint on Column Resize


Quote
Jake Anderson wrote:
> I am using an owner draw listview control and it is working well except that
> when in the report view and the columns are resized the control doesn't
> repaint.  There isn't an OnColumnResize event and all of the other column or
> mouse events don't fire when a column is resized so I can't call invalidate
> there.  

Yesterday I posted a solution to my own same question, but there was a
small bug. The exact solution is as following:

In ComCtrl.pas, change the following procedure, and all will work fine:

procedure TListColumn.SetWidth(Value: TWidth);
var
  i: integer;
  LV: TListView;
begin
  if FWidth <> Value then
  begin
    FWidth := Value;
    DoChange;
    LV := TListColumns(Collection).Owner as TListView;
    with LV do
    try
      for i := TopItem.index to TopItem.index + VisibleRowCount do
      UpdateItems(items[i].Index, items[i].Index);
    except
    end;
  end;
end;

--
Greetings
Frank Heyne

Other Threads