自己写程序添加删除 Item 吧
要是还有更好的办法,我洗耳恭听

解决方案 »

  1.   


    这个框框在Delphi中有现成的,选择New->Forms->Dual List Box!搞定!
      

  2.   

    New->Other->Forms->Dual List Box!
      

  3.   

    程序源代码
    启动Delphi,新建一个工程Project1,从Win32控件面板中拖放一个TListView列表视控件到窗口Form1中,将ViewStyle属性设置为vsReport,接着在ListView1中添加两个列,分别为FileName和Path。好了,列表视设置完成,现在开始在Unit1.Pas进行编码(不要忘了加入shellapi单元),具体如下: 
     
    unit Unit1; 
     
    interface 
     
    uses 
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, shellapi, 
    ComCtrls; 
     
    type 
    TForm1 = class(TForm) 
    ListView1: TListView; 
    procedure FormCreate(Sender: TObject); 
    private 
    { Private declarations } 
    public 
    { Public declarations } 
    procedure AppMessage(var Msg: TMsg; var Handled: Boolean); 
    end; 
     
    var 
    Form1: TForm1; 
     
    implementation 
     
    {$R *.DFM} 
     
    procedure TForm1.FormCreate(Sender: TObject); 
    begin 
    file://设置需要处理文件WM_DROPFILES拖放消息 
    DragAcceptFiles(ListView1.Handle, TRUE); 
    file://设置AppMessage过程来捕获所有消息 
    Application.OnMessage := AppMessage; 
    end; 
     
    procedure TForm1.AppMessage(var Msg: TMsg; var Handled: Boolean); 
    var 
    nFiles, I: Integer; 
    Filename: string; 
    ListItem: TListItem; 
    begin 
    // 
    // 注意!所有消息都将通过这里! 
    // 不要在此过程中编写过多的或者需要长时间操作的代码,否则将影响程序的性能 
    // 
    // 判断是否是发送到ListView1的WM_DROPFILES消息 
    if (Msg.message = WM_DROPFILES) and (msg.hwnd = ListView1.Handle) then 
    begin 
    // 取dropped files的数量 
    nFiles := DragQueryFile (Msg.wParam, $FFFFFFFF, nil, 0); 
    // 循环取每个拖下文件的全文件名 
    try 
    for I := 0 to nFiles - 1 do 
    begin 
    // 为文件名分配缓冲 allocate memory 
    SetLength (Filename, 80); 
    // 取文件名 read the file name 
    DragQueryFile (Msg.wParam, I, PChar (Filename), 80); 
    Filename := PChar (Filename); 
    file://将全文件名分解程文件名和路径 
    ListItem := ListView1.Items.Add; 
    ListItem.Caption := ExtractFileName(FileName); 
    ListItem.SubItems.Add(ExtractFilePath(FileName)); 
    end; 
    finally 
    file://结束这次拖放操作 
    DragFinish (Msg.wParam); 
    end; 
    file://标识已处理了这条消息 
    Handled := True; 
    end; 
    end; 
     
    end. 
      

  4.   

    DstList->Items->Count;//记录数
    DstList->Items->Text;//所有记录
    怎样取出Dstlist中第x个记录???