Я довольно новичок в системе перетаскивания в Delphi для ListView. Я нашел простое решение в Интернете для перетаскивания элементов в ListView. Проблема в том, что код показывает только перетаскивание первого столбца, и я хочу, чтобы показать и перетащить всю строку.Delphi ListView Drag Drop Entire Row
Вы можете посмотреть на картинке ниже, что я получу и что хочу.
procedure TForm1.ListView1DragDrop(Sender, Source: TObject; X, Y: Integer);
var
DragItem, DropItem, CurrentItem, NextItem: TListItem;
begin
if Sender = Source then
with TListView(Sender) do
begin
DropItem := GetItemAt(X, Y);
CurrentItem := Selected;
while CurrentItem <> nil do
begin
NextItem := GetNextItem(CurrentItem, SdAll, [IsSelected]);
if DropItem = nil then DragItem := Items.Add
else
DragItem := Items.Insert(DropItem.Index);
DragItem.Assign(CurrentItem);
CurrentItem.Free;
CurrentItem := NextItem;
end;
end;
end;
procedure TForm1.ListView1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
Accept := Sender = ListView1;
end;
self.ListView1.DragMode := dmAutomatic;
http://docwiki.embarcadero.com/RADStudio/Seattle/en/Customizing_Drag_and_Drop_with_a_Drag_Object –