控件事件顺序:先执行DragOver事件,后执行DragDrop事件

var  
      ListItem:TListItem;  
   
  procedure   TForm1.ListView1DragOver(Sender,   Source:   TObject;   X,   Y:   Integer;  
      State:   TDragState;   var   Accept:   Boolean);  
  begin  
          Accept   :=   true;  
          ListItem:=ListView1.Selected;  
  end;  
   
  procedure   TForm1.ListView1DragDrop(Sender,   Source:   TObject;   X,   Y:   Integer);  
  var  
          InsertItem   :   TListItem;  
  begin  
          if   (Source   is   TListView)   then  
          begin  
                  InsertItem:=ListView1.Items.Insert  
                                          (ListView1.Items.IndexOf(ListView1.GetItemAt(X,Y)));  
                  InsertItem.Assign(ListItem);  
                  ListView1.Selected.Delete;  
          end;  
  end;  

相关文章:

  • 2021-07-05
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
  • 2018-11-27
  • 2022-12-23
猜你喜欢
  • 2021-08-19
  • 2021-06-24
  • 2021-10-19
  • 2021-11-28
  • 2021-04-09
  • 2021-10-21
  • 2021-10-01
相关资源
相似解决方案