Not much has been tested, but the attempt below includes a timer when the item is dragged outside the control over its parent (in the case of an example, a form), and the timer event checks the cursor position to find out if the scroll message should be sent to the list.
procedure TForm1.FormCreate(Sender: TObject); begin Timer1.Enabled := False; Timer1.Interval := 500; end; procedure TForm1.FormDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); begin if Source = ListView1 then Timer1.Enabled := True else Timer1.Enabled := False; end; procedure TForm1.Timer1Timer(Sender: TObject); var Pt: TPoint; begin // Stop timer and exit if not dragging any more if not ListView1.Dragging then begin Timer1.Enabled := False; Exit; end; Pt := ListView1.ScreenToClient(Mouse.CursorPos); if Pt.Y < 0 then ListView1.Perform(WM_VSCROLL, SB_LINEUP, 0) else if Pt.Y > ListView1.ClientHeight then ListView1.Perform(WM_VSCROLL, SB_LINEDOWN, 0) else Timer1.Enabled := False; end; procedure TForm1.FormDragDrop(Sender, Source: TObject; X, Y: Integer); begin Timer1.Enabled := False; end;
If it works Well, you can enable horizontal scrolling.
source share