zoukankan      html  css  js  c++  java
  • Delphi TListview[3]实现拖拽功能

    Delphi TListview[3]实现拖拽功能

    1、设置ListView1的属性:

    Listview1.DragMode:=dmAutomatic;

    2、OnDragOver事件:

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

    3、OnDragDrop事件:

    procedure TForm1.ListView1DragDrop(Sender, Source: TObject; X, Y: Integer);
    var
      aItem, bItem: TListItem;
    begin
      if (Source is TListView) then
      begin
        bItem := (Source as TListView).Selected;
        aItem := (Source as TListView).Items.Insert((Source as TListView).Items.IndexOf((Source as TListView).GetItemAt(X, Y)));
        aItem.Assign(bItem);
        (Source as TListView).Selected.Delete;
        aItem.Selected := True;
      end;
    end;
    

      

    创建时间:2020.03.20  更新时间:

  • 相关阅读:
    磁盘冗余 ---RAID磁盘管理
    linux磁盘管理
    linux基础命令
    Apache配置rewrite
    memcache运维整理
    mysql主从配置
    rsync相关整理
    Lua 学习笔记(六)
    Lua 学习笔记(五)
    Lua 学习笔记(四)
  • 原文地址:https://www.cnblogs.com/guorongtao/p/12532461.html
Copyright © 2011-2022 走看看