procedure TfrmMain.lbListDragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState;
var Accept: Boolean);
var verschieben, ItemPos, i : Integer;
begin
if (Source
is TNoScrollListBox)
and ((Source
as TNoScrollListBox).SelCount > 0)
then
with Source
as TNoScrollListBox
do
begin
ItemPos := ItemAtPos(point(x, y), true);
if (ItemPos < 0)
or (ItemPos >= Items.Count)
then
exit;
if Selected[ItemPos]
then
ItemIndex := ItemPos;
verschieben := ItemIndex - ItemPos;
if verschieben <> 0
then
begin
if verschieben > 0
then
i := 0
else
i := Pred(Items.Count);
while (i >= 0)
and (i < Items.Count)
do
begin
if Selected[i]
then
begin
if (i- verschieben >= 0)
and (i - verschieben < Items.Count)
then
begin
Items.Move(i, i - verschieben);
Move(fFiles[i], fFiles[i - verschieben], (i - verschieben) - i * SizeOf(fFiles[i]));
Selected[i] := False;
Selected[i- verschieben] := True;
end else
Break;
end;
if verschieben > 0
then
inc(i)
else
dec(i);
end;
end;
Accept:= True
end else
Accept:= False;
end;