AI摘要

This article explains how to use a dialog window to select a folder without using a TOpenDialog component in Delphi. It provides a step-by-step guide on how to use the SelectDirectory function and includes sample code for a button's onClick event.
This articl

You can accomplish this without using a TOpenDialog component. First, add FileCtrl to the Uses. Now the SelectDirectory function can be used. Drop a TButton component on your Form. Place the following code in the button's onClick event to get a demonstration of how this function works:

~~~~~~~~~~~~~~~~~~~~~~~~~
procedure TForm1.Button1Click(Sender: TObject) ;
const
     SELDIRHELP = 1000;
var
   dir: String;
begin
   dir := 'C:';
   if SelectDirectory(
        dir,
        [sdAllowCreate,
        sdPerformCreate,
        sdPrompt],
        SELDIRHELP
      ) then
     Button1.Caption := dir;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~

※相关文章推荐※



最后修改:2009 年 08 月 16 日
点赞的人是最酷的