Thema: Delphi Problem mit Drag Drob

Einzelnen Beitrag anzeigen

Benutzerbild von Sprint
Sprint

Registriert seit: 18. Aug 2004
Ort: Edewecht
712 Beiträge
 
Delphi 5 Professional
 
#2

Re: Problem mit Drag Drob

  Alt 23. Mär 2005, 11:51
Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
begin
  FileListBox1.DragMode := dmAutomatic;
end;

procedure TForm1.ListBox1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
begin
  Accept := Source is TFileListBox;
end;

procedure TForm1.ListBox1DragDrop(Sender, Source: TObject; X, Y: Integer);
var
  I, P: Integer;
begin
  P := (Sender as TListBox).ItemAtPos(Point(X, Y), False);
  with Source as TFileListBox do
    for I := Items.Count - 1 downto 0 do
      if Selected[I] then
        (Sender as TListBox).Items.Insert(P, Items.Strings[I]);
end;
Ciao, Sprint.

"I don't know what I am doing, but I am sure I am having fun!"
  Mit Zitat antworten Zitat