unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls;
type
TForm3 =
class(TForm)
ListView1: TListView;
procedure ListView1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ListView1DragDrop(Sender, Source: TObject; X, Y: Integer);
procedure ListView1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState;
var Accept: Boolean);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
procedure TForm3.FormCreate(Sender: TObject);
begin
ReportMemoryLeaksOnShutDown := true;
end;
procedure TForm3.ListView1DragDrop(Sender, Source: TObject; X, Y: Integer);
var
li:TListItem;
begin
li:= TListItem.Create(ListView1.Items);
li.Assign(ListView1.DropTarget);
ListView1.DropTarget.Assign((ListView1.Items[ListView1.Itemindex]));
ListView1.Items[ListView1.Itemindex].Assign(li);
li.Free;
end;
procedure TForm3.ListView1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState;
var Accept: Boolean);
begin
Accept := Source=Sender;
end;
procedure TForm3.ListView1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Button=mbLeft
then ListView1.BeginDrag(false);
end;
end.