SelectDirectory有两个函数,另外一个Delphi有Form,应该是显示中间的,当然没有系统的好看。
另外自己做的话TShellTreeView应该是不错的选择。

解决方案 »

  1.   

    这个是selectDirectory的代码,自己改改就行了!
    function SelectDirectory(var Directory: string;
      Options: TSelectDirOpts; HelpCtx: Longint): Boolean;
    var
      D: TSelectDirDlg;
    begin
      D := TSelectDirDlg.Create(Application);
      try
        D.Directory := Directory;
        D.AllowCreate := sdAllowCreate in Options;
        D.Prompt := sdPrompt in Options;    { scale to screen res }
        if Screen.PixelsPerInch <> 96 then
        begin
          D.ScaleBy(Screen.PixelsPerInch, 96);
          D.FileList.ParentFont := True;
          D.Left := (Screen.Width div 2) - (D.Width div 2);
          D.Top := (Screen.Height div 2) - (D.Height div 2);
          D.FileList.Font.Color := clGrayText;
        end;    if HelpCtx = 0 then
        begin
          D.HelpButton.Visible := False;
          D.OKButton.Left := D.CancelButton.Left;
          D.CancelButton.Left := D.HelpButton.Left;
        end
        else D.HelpContext := HelpCtx;    Result := D.ShowModal = mrOK;
        if Result then
        begin
          Directory := D.Directory;
          if sdPerformCreate in Options then
            ForceDirectories(Directory);
        end;
      finally
        D.Free;
      end;
    end;
      

  2.   

    uses
     ActiveX;procedure TForm1.ePathDblClick(Sender: TObject);
    var
      SelectionPIDL: PItemIDList;
      BrowseInfo: TBrowseInfo;
      ShellAllocator: IMalloc;
      PathBuffer: array[0..MAX_PATH] of Char;
    begin
      ZeroMemory(@BrowseInfo, SizeOf(BrowseInfo));
      BrowseInfo.hwndOwner := Handle;
      BrowseInfo.ulFlags := BIF_RETURNONLYFSDIRS;
      CoInitialize(nil);
      try
        SelectionPIDL := ShBrowseForFolder(BrowseInfo);
        if SelectionPIDL <> nil then
        try
          ZeroMemory(@PathBuffer, SizeOf(PathBuffer));
          if not SHGetPathFromIDList(SelectionPIDL, @PathBuffer) then
          begin
            beep;
            exit;
          end;
          ShowMessAGE(StrPas(@PathBuffer[0]));
        finally
          if SHGetMalloc(ShellAllocator) = 0 then
          begin
            ShellAllocator.Free(SelectionPIDL);
            ShellAllocator := nil;
          end;
        end;
      finally
        CoUnInitialize;
      end;
    end;