如何得到在目录列表框directorylistbox1选择的目录?
DirectoryListBox1.OpenCurrent;
  Label1.Caption := DirectoryListBox1.GetItemPath(1);

解决方案 »

  1.   

    引用单元; uses FileCtrl;
    var
      sDir: string;
    begin
       SelectDirectory( '对话框的标题','',sDir )
      //sDir 放的就是你要的文件夹路径如果用directorylistbox1:
    procedure TForm1.DirectoryListBox1Click(Sender: TObject);
    var
      i:integer;
      j:integer;
      s:string;
    begin
    i:=DirectoryListBox1.ItemIndex;
    j:=0;
    while j<=i do
      begin
        s:=DirectoryListBox1.Items.Strings[j];
        if j>1 then
          edit1.text:=edit1.text+'\'+s
        else
          edit1.text:=edit1.text+s;
        j:=j+1;
      end;
    end;