«á¤@­¶
«e¤@­¶
¦^¥Ø¿ý
¦^­º­¶
²Ä¤»³¹¡@¤å¥óºÞ²z¡]¤T¡^

2.µe¥X¨C­Ó¦Ûµe¶µ¥Ø¡@

¡@¡@³o¦bTabSetªºOnDrawTab¨Æ¥ó³B²z¹Lµ{¤¤§¹¦¨¡C³o¤@¨Æ¥ó³B²z¹Lµ{ªº°Ñ¼Æ¤¤¥]§t¤F«Ýµe¶µ¥Ø¯Á¤Þ¡BµeªO¡B«Ýµe°ÏÄæ¦ì¡B¬O§_³Q¿ï¤¤µ¥¡C³oùاڭ̥u§Q¥Î¤F«e¤T­Ó°Ñ¼Æ¡C¨Æ¹ê¤W§Q¥Î³Ì«á¤@­Ó°Ñ¼Æ¡A§Ú­Ì¥i¥H¹ï³Q¿ï¤¤ªº¼ÐÅÒ¶i¦æ¤@¨Ç¯S®íªºµøı®ÄªG³B²z¡C³o¤@¤u§@´N¯dµ¹ÅªªÌ¦Û¤v¥h§¹¦¨¡C¡@

procedure TFMForm.DriveTabSetDrawTab(Sender: TObject; TabCanvas: TCanvas;

R: TRect; Index: Integer; Selected: Boolean);

var

Bitmap: TBitmap;

begin

Bitmap := TBitmap(DriveTabSet.Tabs.Objects[Index]);

with TabCanvas do

begin

Draw(R.Left, R.Top + 4, Bitmap);

TextOut(R.Left + 2 + Bitmap.Width, R.Top + 2, DriveTabSet.Tabs[Index]);

end;

end;¡@

6.4.5 ¤å¥óºÞ²z°ò¥»¥\¯àªº¹ê²{¡@

¡@¡@¦b¤lµøµ¡ªºFile¿ï¾Üªí¤¤¡A©w¸q¤F¤å¥óºÞ²zªº°ò¥»¥\¯à¡A¥¦­Ì¬O¡G

¡@¡@¡´ Open ¡G¥´¶}©Î°õ¦æ¤@­Ó¤å¥ó(±q¤å¥ó¦C¥Ü¤è¶ô³sÄò«ö¨â¤U¸Ó¤å¥ó¥i¹ê²{¦P¼Ë®ÄªG)

¡´ Move ¡G¤å¥ó¦b¤£¦P¥Ø¿ý¶¡ªº²¾°Ê

¡@¡@¡´ Copy ¡G¤å¥ó«þ¨©

¡@¡@¡´ Delete ¡G¤å¥ó¸Ñ°£

¡@¡@¡´ Rename ¡G¤å¥ó§ó¦W

¡@¡@¡´ Properties ¡GÅã¥Ü¤å¥óÄÝ©Ê¡@

6.4.5.1 ¤å¥ó¥´¶}¡@

¡@¡@¤å¥ó¥´¶}¥\¯à¥i¥H°õ¦æ¤@­Ó¥i°õ¦æ¤å¥ó¡A©Î§â¤å¥ó¦b»P¤§¬ÛÃöÁpªºÀ³¥Îµ{¦¡¤¤¥´¶}¡C¤å¥óÁ`¬O»P«Ø¥ß¥¦ªºÀ³¥Îµ{¦¡¬ÛÃöÁp¡A³oºØÃöÁp¥i¥H¦bWindowsªº¤å¥óºÞ²z¾¹¤¤­×§ï¡C­nª`·Nªº¬O¡G¤å¥óªºÃöÁp¬O¥H«áºó¦W¬°¼Ð»xªº¡A¦]¦Ó¹ï¤@­Ó¤å¥óÃöÁp¤è¦¡ªº­×§ï±N¼vÅT©Ò¦³¬Û¦P«áºó¦Wªº¤å¥ó¡C

¡@¡@¤å¥ó¥´¶}¥\¯à¹ê²{ªºÃöÁä¬O§Q¥Î¤FWindows API¨ç¼ÆShellExecute ¡C¥Ñ©óWindows API¨ç¼Æªº°Ñ¼Æ­n¨D¦r¤¸¦ê«¬¦¡¬OPChar¡A¦ÓDelphi¤¤¤@¯ë¥Îªº¬O¦³µ²§ô¼Ð»xªºString«¬¦¡¡A¦]¦¹¬°©I¥s¤è«K§Ú­Ì§â³o¤@¨ç¼Æ¶i¦æ¤F­«·s©w¸q¦p¤U¡C¡@

function ExecuteFile(const FileName, Params, DefaultDir: String;

ShowCmd: Integer): THandle;

var

zFileName, zParams, zDir: array[0..79] of Char;

begin

Result := ShellExecute(Application.MainForm.Handle, nil,

StrPCopy(zFileName, FileName), StrPCopy(zParams, Params),

StrPCopy(zDir, DefaultDir), ShowCmd);

end;

¡@¡@¥H¤W¨ç¼Æ¦bfmxutils³æ¤¸¤¤©w¸q¡Cfmxutils¬O¤@­Ó¦Û©w¸q¥N½X³æ¤¸¡C

¡@¡@¦³ÃöShellExecute¤¤¦U°Ñ¼Æªº¨ãÅé§t¸qŪªÌ¥i¬d¾\³s½uHelp¤å¥ó¡C

¡@¡@StrPCopy§â¤@­ÓPascal«¬¦¡ªº¦r¤¸¦ê«þ¨©¨ì¤@­ÓµLµ²§ô²ÅªºPChar«¬¦¡¦r¤¸¦ê¤¤¡C

¡@¡@¦b¤lµøµ¡ªºOpen1Click¨Æ¥ó³B²z¹Lµ{¤¤¡G¡@

procedure TFMForm.Open1Click(Sender: TObject);

begin

with FileList do

ExecuteFile(FileName, '', Directory, SW_SHOW) ;

end;

¡@¡@¦pªGFileList¤¹³\Åã¥Ü¥Ø¿ýªº¸Ü(§YFileTypeÄݩʦA¼W¥[¤@¶µftDirectory)¡A¨º»ò¹ï©ó¤@­Ó¥Ø¿ý¦Ó¨¥¡A¥´¶}ªº§t¸qÀ³¸Ó¬OÅã¥Ü¥¦¤UÃ䪺¤l¥Ø¿ý©M¤å¥ó¡Cµ{¦¡­×§ï¦p¤U¡C¡@

¡@ procefure TFMForm.Open1Click(Sender: Tobject);

begin

With FileList do

begin

if HasAttr(FileName,faDirectory) then

DirectoryOutline.Directory := FileName

else

ExecuteFile(FileName,' ' ,Directory,SW_SHOW);

end;

end;¡@

¨ä¤¤HasAttr¬O¤@­Ófmxutils³æ¤¸¤¤ªº¦Û©w¸q¨ç¼Æ¡A¥Î©ó°»´ú«ü©w¤å¥ó¬O§_¨ã¦³¬YºØÄÝ©Ê¡C¡@

function HasAttr(const FileName: String; Attr: Word): Boolean;

begin

Result := (FileGetAttr(FileName) and Attr) = Attr;

end;¡@

6.4.5.2 ¤å¥ó«þ¨©¡B²¾°Ê¡B¸Ñ°£¡B§ó¦W¡@

¡@¡@¤å¥ó«þ¨©ªºÃöÁä¬O¨Ï¥Î¤F¥H¤å¥ó¥y¬`¬°¾Þ§@ª«¥óªº¤å¥óºÞ²z¨ç¼Æ¡A¦]¦Ó´£¨Ñ¤F¤@ºØ©³¼hªºI/O³q¹D¡C¦bObject Pascal¤¤³o¤@ÂI¬O§Q¥ÎµL«¬¦¡¤å¥ó¹ê²{ªº¡C

¡@¡@¦b¤å¥ó«þ¨©¤¤­º¥ýÀˬd¥Ø¼ÐÀÉ®×¼Ðñ¬O§_¬O¤@­Ó¥Ø¿ý¡C¦p¬O«h§â­ì¤å¥óªºÀÉ®×¼Ðñ¥[¤J¨ì¥Ø¼Ð¸ô®|«á¡A²£¥Í¥Ø¼Ð¤å¥ó¥þ¸ô®|¦W¡C¦Ó«á´£¨ú·½¤å¥óªº®É¶¡ÂW¡A¥H³Æ«þ¨©§¹¦¨«á³]©w¥Ø¼Ð¤å¥ó¡C«þ¨©¹Lµ{¤¤¨Ï¥Î¤Fªð¦^¤å¥ó¥y¬`©Î¥H¤å¥ó¥y¬`¬°°Ñ¼Æªº¤å¥óºÞ²z¨ç¼ÆFileOpen¡BFileCreate¡BFileRead¡BFileWrite¡BFileClose¡C¬°«OÃÒ¤å¥óªº¥¿±`Ãö³¬©M°O¾ÐÅ骺ÄÀ©ñ¡A¦b«þ¨©¹Lµ{¤¤¶i¦æ²§±`«OÅ@¡C

¹Lµ{CopyFile¹ê²{¤W­z¥\¯à¡A¥¦©w¸q¦bfmxutils³æ¤¸¤¤¡C¡@

procedure CopyFile(const FileName, DestName: TFileName);

var

CopyBuffer: Pointer;

TimeStamp, BytesCopied: Longint;

Source, Dest: Integer;

Destination: TFileName;

const

ChunkSize: Longint = 8192;

begin

Destination := ExpandFileName(DestName);

if HasAttr(Destination, faDirectory) then

Destination := Destination + '\' + ExtractFileName(FileName);

TimeStamp := FileAge(FileName);

GetMem(CopyBuffer, ChunkSize);

try

Source := FileOpen(FileName, fmShareDenyWrite);

if Source < 0 then

raise EFOpenError.Create(FmtLoadStr(SFOpenError, [FileName]));

try

Dest := FileCreate(Destination);

if Dest < 0 then

raise EFCreateError.Create(FmtLoadStr(SFCreateError,[Destination]));

try

repeat

BytesCopied := FileRead(Source, CopyBuffer^, ChunkSize);

if BytesCopied > 0 then

FileWrite(Dest, CopyBuffer^, BytesCopied);

until BytesCopied < ChunkSize;

finally

FileSetDate(Dest,TimeStamp);

FileClose(Dest);

end;

finally

FileClose(Source);

end;

finally

FreeMem(CopyBuffer, ChunkSize);

end;

end;

¡@¡@¦pªG§Ú­Ì¤£¨Ï¥ÎFileSetDate¹Lµ{¡AWindows¦Û°Ê§â¥Ø«e®É¶¡§@¬°®É¶¡ÂW¼g¤J¤å¥ó¡C

¡@¡@¤å¥ó²¾°Ê¨Æ¹ê¤W¬O¤å¥ó«þ¨©»P¤å¥ó¸Ñ°£ªºµ²¦X¡Cfmxutils³æ¤¸¤¤ªºMoveFile¹Lµ{¹ê²{¤F³o¤@¥\¯à¡C¡@

procedure MoveFile(const FileName, DestName: TFileName);

var

Destination: TFileName;

begin

Destination := ExpandFileName(DestName);

if not RenameFile(FileName, Destination) then

begin

if HasAttr(FileName, faReadOnly) then

raise EFCantMove.Create(Format(SFCantMove, [FileName]));

CopyFile(FileName, Destination);

DeleteFile(FileName);

end;

end;¡@

EFCanMove¬O¤@­Ó¦Û©w¸q²§±`Ãþ¡G¡@

¡@¡@type

EFCanMove := Class(EStreamError);

¡@¡@¦³Ãö¦Û©w¸q²§±`Ãþ½Ð°Ñ¾\²Ä¤Q¤G³¹¡C

¡@¡@¤å¥ó¸Ñ°£¡B¤å¥ó§ó¦Wª½±µ©I¥sDelphi¤å¥óºÞ²z¹Lµ{DeleteFile¡BRenameFile¡C¥¦­Ì³£¥HÀÉ®×¼Ðñ¬°°Ñ¼Æ¡C¾Þ§@°õ¦æ«eÀ³¼u¥X¤@­Ó¹ï¸Ü¤è¶ô¶i¦æ½T»{¡A°õ¦æ§¹²¦«áÀ³©I¥sUpdate¤èªk§ó·sFileListªºÅã¥Ü¡C¡@

6.4.5.3 ¤@­Pªº¤¶­±¡@

¡@¡@¤å¥ó«þ¨©¡B¤å¥ó²¾°Ê¡B ¤å¥ó§ó¦W¥H¤Î«áÃ䪺§ïÅܥثe¤u§@¥Ø¿ý¦b§Î¦¡¤W³£ªí²{¬°±q¤@­Ó·½¤å¥ó¨ì¤@­Ó¥Ø¼Ð¤å¥ó¡C¦]¦Ó¥i¥H±Ä¥Î²Î¤@ªº¥Î¤á¤¶­±¡A§YChangeForm¹ï¸Ü¤è¶ô

³o¥|­Ó¿ï¾Üªí¶µ¦@¥Î¤@­ÓClick¨Æ¥ó³B²z¹Lµ{¡A³q¹L¹ïSender°Ñ¼Æªº°»´ú¡A¨M©w±N­n¥´¶}¹ï¸Ü¤è¶ôªº¼ÐÃD©MÅã¥Ü¤º®e¡C·í¥Î¤á«öOKÁäÃö³¬¥B¥Ø¼Ð¤å¥ó(¥Ø¿ý)«DªÅ®É¡Aµ{¦¡¼u¥X¤@­Ó°T®§¹ï¸Ü¤è¶ô­n¨D¥Î¤á¶i¤@¨B½T»{¡A¦Ó«á°õ¦æ¬ÛÀ³ªº°Ê§@¡C

¡@¡@¦@¥Îªº¨Æ¥ó³B²z¹Lµ{FileChangeªºµ{¦¡²M³æ¦p¤U¡G¡@

procedure TFMForm.FileChange(Sender: TObject);

var

ChangeForm: TChangeForm;

IsFile: Boolean;

begin

ChangeForm := TchangeForm.Create(Self);

IsFile := True;

with ChangeForm do

begin

if Sender = Move1 then Caption := 'Move'

else if Sender = Copy1 then Caption := 'Copy'

else if Sender = Rename1 then Caption := 'Rename'

else if Sender = ChangeDirectory1 then

begin

Caption:='Change Directory';

IsFile:=False;

end

else Exit;

if IsFile then

begin

CurrentDir.Caption := FileList.Directory;

FromFileName.Text := FileList.FileName;

ToFileName.Text := '';

end

else

begin

CurrentDir.Caption := DriveTabSet.Tabs[DriveTabSet.TabIndex];

FromFileName.Text := DirectoryOutline.Directory;

ToFileName.Text := '';

end;

if (ShowModal <> idCancel) and (ToFileName.Text <> '') then

ConfirmChange(Caption, FromFileName.Text, ToFileName.Text);

end;

end;¡@

¨ä¤¤¥Î¨ìªº¦Û©w¸q¨p¦³¹Lµ{ConfirmChange¥Î©ó°õ¦æ¬ÛÀ³ªº°Ê§@¡G¡@

procedure TFMForm.ConfirmChange(const ACaption, FromFile, ToFile: String);

begin

if MessageDlg(Format('%s %s to %s', [ACaption, FromFile, ToFile]),

mtConfirmation, [mbYes, mbNo], 0) = idYes then

begin

if ACaption = 'Move' then

MoveFile(FromFile, ToFile)

else if ACaption = 'Copy' then

CopyFile(FromFile, ToFile)

else if ACaption = 'Rename' then

RenameFile(FromFile, ToFile)

else if ACaption = 'Change Directory' then

changeDirectory(ToFile);

FileList.Update;

end;

end;¡@

6.4.5.4 Åã¥Ü¤å¥óÄÝ©Ê¡@

¡@¡@·íµ{¦¡°õ¦æProperties ¿ï¾Üªí¶µªºClick ¨Æ¥ó³B²z¹Lµ{®É¡A­º¥ý¼u¥X¤@­ÓTFileAttrForm«¬¦¡ªº¹ï¸Ü¤è¶ô¡AÅã¥Ü¤å¥óªºÄÝ©Ê

·í¥Î¤á­×§ï¨Ã½T»{«áµ{¦¡­«·s³]©w¤å¥óÄÝ©Ê¡C

¡@¡@Properties¿ï¾Üªí¶µªºClick¨Æ¥ó³B²z¹Lµ{¦p¤U¡G¡@

procedure TFMForm.Properties1Click(Sender: TObject);

var

Attributes, NewAttributes: Word;

FileAttrForm: TFileAttrForm;

begin

FileAttrForm := TFileAttrForm.Create(self);

ShowFileAttr(FileAttrForm,FileList.FileName,FileList.Directory);

end;

¡@¡@¨ä¤¤¹Lµ{ShowFileAttrªº¹ê²{¦p¤U¡G¡@

procedure TFMForm.ShowFileAttr(FileAttrForm:TFileAttrForm;

AFileName,Directory:String);

var

Attributes,NewAttributes: Word;

begin

with FileAttrForm do

begin

FileName.Caption := AFileName;

FilePath.Caption := Directory;

ChangeDate.Caption := DateTimeToStr(FileDateTime(AFileName));

Attributes := FileGetAttr(AFileName);

ReadOnly.Checked := (Attributes and faReadOnly) = faReadOnly;

Archive.Checked := (Attributes and faArchive) = faArchive;

System.Checked := (Attributes and faSysFile) = faSysFile;

Hidden.Checked := (Attributes and faHidden) = faHidden;

if ShowModal <> idCancel then

begin

NewAttributes := Attributes;

if ReadOnly.Checked then NewAttributes := NewAttributes or faReadOnly

else NewAttributes := NewAttributes and not faReadOnly;

if Archive.Checked then NewAttributes := NewAttributes or faArchive

else NewAttributes := NewAttributes and not faArchive;

if System.Checked then NewAttributes := NewAttributes or faSysFile

else NewAttributes := NewAttributes and not faSysFile;

if Hidden.Checked then NewAttributes := NewAttributes or faHidden

else NewAttributes := NewAttributes and not faHidden;

if NewAttributes <> Attributes then

FileSetAttr(AFileName, NewAttributes);

end;

end;

end;¡@

¥H¤W¹Lµ{¤¤¥Î¨ìªº¨ç¼ÆFileDataTime¦bfmxutils³æ¤¸¤¤©w¸q¡Aªð¦^¤@­ÓTDatatime«¬¦¡ªºÅܼơC¡@

function FileDateTime(const FileName: String): System.TDateTime;

begin

Result := FileDateToDateTime(FileAge(FileName));

end;¡@

6.4.6 ¨ä¥¦¤å¥óºÞ²z¥\¯àªº¹ê²{¡@

¡@¡@¦b¤lµøµ¡ªºFunction¿ï¾Üªí¤¤¡A©w¸q¤F¤@¨Ç¨ä¥¦ªº¤å¥óºÞ²z¥\¯à¡G

¡@¡@¡´ Search ¡G§ä¨ì¤@­Óµ¹©w¦W¦rªº¤å¥ó¡A­Y¦s¦b«hÅã¥Ü¸Ó¤å¥óÄÝ©Ê

¡@¡@¡´ Disk View ¡GÅã¥Ü¥Ø«eºÏºÐ¾÷ªº¤j¤p©M³Ñ¾lªÅ¶¡

¡@¡@¡´ View type ¡G½T©wÅã¥Ü¤å¥óªº«¬¦¡¡@

6.4.6.1 ¤å¥ó§ä¨ì¡@

¡@¡@·í¥Î¤á«ö¤@¤USearch¿ï¾Üªí¶µ®É¡Aµ{¦¡¼u¥X¤@­Ó¹ï¸Ü¤è¶ô(¦p¹Ï6.10)¡A­n¨D¿é¤J«Ý§ä¨ìªºÀÉ®×¼Ðñ©M§ä¨ì¸ô®|¡CÀÉ®×¼Ðñ¥i¥H¬O¸U¥Î¦r¤¸²Å¸¹¡C·í¥Î¤á½T»{«áµ{¦¡Åã¥Ü²Ä¤@­Ó¤Ç°t¤å¥óªºÄÝ©Ê(¦p¹Ï6.9)¡C§ä¨ì¤£¨ì¤Ç°t¤å¥ó«hµ¹¥X¬ÛÀ³ªº¸ê°T¡C

       ¦b¹ê²{³o¤@¥\¯àªº³Ìªì³]­p¤¤¡A§Ú¸Õ¹Ï¨Ï¥ÎFileSearch¨ç¼Æ¡A³o­Ó¨ç¼Æ¤¹³\¦b¦h­Ó¤£¦P¸ô®|¤¤§ä¨ì¡C¦ý¥i±¤ªº¬O¡G¤]³\¥Ñ©ó¨t²Î³]­pªÌªº¥¢»~¡A³o­Ó¨ç¼Æ¨Ã¨S¦³ªð¦^¥¦À³¸Óªð¦^ªºªF¦è(²Ä¤@­Ó¤Ç°t¤å¥óªº¥þ¸ô®|¦W)¡A¦Ó¬O¤´§â¿é¤Jªº¤Ç°t²Åªð¦^¡C

¡@¡@¨S¦³¿ìªk§Ú¥u¯à¦A¦¸¨Ï¥ÎFindFirst¡A³o­Ó¨ç¼Æªº¯S©Ê¦b6.3¸`¤¤¤w¶i¦æ¤F¤¶²Ð¡C¤U­±¬O³o¤@¥\¯àªº¹ê²{¥N½X¡C¡@

procedure TFMForm.search1Click(Sender: TObject);

var

SearchForm: TSearchForm;

FileAttrForm: TFileAttrForm;

FindIt,path: String;

SearchRec: TSearchRec;

Return: Integer;

begin

SearchForm := TSearchForm.Create(self);

with SearchForm do

begin

SearchFile.text := '';

SearchPath.text := DirectoryOutline.Directory;

if (ShowModal <> idCancel) and

(SearchFile.Text <> '') and (SearchPath.text <> '') then

begin

FindIt := SearchPath.text+'\'+SearchFile.text;

Return := FindFirst(FindIt,faAnyFile,SearchRec);

if Return <> 0 then

FindIt := ''

else

FindIt := ExpandFileName(SearchRec.Name);

end;

if FindIt = '' then

MessageDlg('Cannot find the file in current directory.',

mtWarning, [mbOk], 0)

else

begin

Path := ExtractFilePath(FindIt);

FindIt := ExtractFileName(FindIt);

FileAttrForm := TFileAttrForm.Create(self);

ShowFileAttr(FileAttrForm,FindIt,Path);

end;

end;

end;¡@

6.4.6.2 Åã¥ÜºÏºÐ¸ê°T

¡@¡@·í¥Î¤á«ö¤@¤UDisk View¿ï¾Üªí¶µ®É¡A±N¼u¥X¤@­ÓTDiskViewForm«¬¦¡ªº¹ï¸Ü¤è¶ô¡A¥Î¨ÓÅã¥Ü¥Ø«eºÏºÐªº¸ê°T

         ºÏºÐ¸ê°TªºÀò¨ú¬O¦bDiskViewForm¤¤DriveEdit½s¿è®ØªºOnChange¨Æ¥ó³B²z¹Lµ{¤¤¹ê²{ªº¡C¡@

procedure TDiskViewForm.driveEditChange(Sender: TObject);

var

dr: Byte;

Free,Total: LongInt;

begin

Free := DiskFree(0);

Total := DiskSize(0);

FreeSpace.text := IntToStr(Free)+ ' bytes.';

TotalSpace.text := IntToStr(Total) + ' bytes.';

end;

¡@¡@DiskFree¡BDiskSize±a°Ñ¼Æ¬°0ªí¥Ü¥Ø«eºÏºÐ¾÷¡CŪªÌ¥i¥H«Ü®e©ö§â¥¦§ï¦¨«ö¥Î¤á¿é¤JÅã¥ÜºÏºÐ¸ê°Tªº±¡ªp¡C

¡@¡@DiskViewForm¤¤ªº¤T­Ó½s¿è®Ø³]­p®É³£¥OReadOnly¬°True¡C¡@

6.4.6.3 §ïÅÜÅã¥Ü¤å¥óªº«¬¦¡¡@

¡@¡@§ïÅÜÅã¥Ü¤å¥óªº«¬¦¡¨Æ¹ê¤W¬O³]©wFileListªºMaskÄÝ©Ê¡C§Ú­Ì§Q¥Î¤@­Ó¼Ð·ÇªºInputBox¿é¤J¤å¥óªº¤Ç°t¦r¤¸¦ê¡C¦Ó«á§Q¥ÎUpdate¤èªk§ó·sFileList¡C¡@

procedure TFMForm.Viewtype1Click(Sender: TObject);

var

FileMask: String;

begin

FileMask := InputBox('File type','Input File type For View :',FileList.Mask);

If FileMask = '' then FileMask := '*.*';

FileList.Mask := FileMask;

FileList.Update;

CreateCaption;

end;

¡@¡@¨ä¤¤ªºCreateCaption¨p¦³¹Lµ{±N¦b(6.4.8)¤¤¶i¦æ¤¶²Ð¡C¡@

6.4.7 ¥Ø¿ýºÞ²z¥\¯àªº¹ê²{¡@

¡@¡@¦b¤lµøµ¡ªºDirectory¿ï¾Üªí¤¤¡A´£¨Ñ¤F¥Ø¿ýºÞ²z¥\¯à¡G

¡@¡@¡´ Create Directory ¡G«Ø¥ß¤@­Ó¤l¥Ø¿ý

¡@¡@¡´ Delete Directory ¡G¸Ñ°£¤@­ÓªÅªº¤l¥Ø¿ý

¡@¡@¡´ Change Directory ¡G§ïÅܥثe¤u§@¥Ø¿ý¡@

6.4.7.1 «Ø¥ß¥Ø¿ý¡@

¡@¡@«Ø¥ß¥Ø¿ý®É­º¥ý¼u¥X¤@­ÓTNewDir«¬¦¡ªº¹ï¸Ü¤è¶ô

¹ï¸Ü¤è¶ô¤¤­n¨D¥Î¤á¿é¤J¥Ø¿ý¦W¡C¦pªG¥Î¤á¤£¿é¤J¸ô®|¡A«h¯Ê¬Ù»{©w¬°¥Ø«e¤u§@¥Ø¿ýªº¤l¥Ø¿ý¡G¡@

¡@¡@Dir := ExpandFileName(DirName.Text)¡F¡@

¡@¡@¦Ó«á©I¥sMkDir¨ç¼Æ¡C¦b¥Ø¿ý«Ø¥ß¹Lµ{¤¤Ãö³¬¤FI/O¿ù»~°»´ú¡A¥X¿ù¤£²£¥Í²§±`¦Ó¬O§âIOResult³]©w¬°«D¹s­È¡C³q¹LÀˬdIOResult¬O§_¬°0¥i¥H½T©w«Ø¥ß¬O§_¦¨¥\¡C

µ{¦¡²M³æ¦p¤U¡G¡@

procedure TFMForm.CreateDirectory1Click(Sender: TObject);

var

NewDir: TNewDir;

Dir: String;

begin

{$I-}

NewDir := TNewDir.Create(self);

with NewDir do

begin

CurrentDir.Caption := DirectoryOutline.Directory;

if (ShowModal <> idCancel) and (DirName.Text <> '') then

Dir := ExpandFileName(DirName.text);

end;

MkDir(Dir);

if IOResult <> 0 then

MessageDlg('Cannot Create directory', mtWarning, [mbOk], 0);

end;

¡@¡@¦ý¤£©¯ªº¬O¥Ø¿ý«Ø¥ß«á§Ú­Ì«oµLªk±q¥Ø«e¤u§@¥Ø¿ý¾ð¤¤¬Ý¨ì¡C¥²¶·²¾¨ì¥t¤@­ÓºÏºÐ¾÷¦Ó«á¦Aªð¦^¡A«Ø¥ßªº¥Ø¿ý¤~¬O¥i¨£ªº¡C¦b«áÃä§Ú­Ì±N´£¨Ñ¤@ºØ¸Ñ¨M¤èªk¡C¡@

6.4.7.2 ¸Ñ°£¥Ø¿ý¡@

¡@¡@¦b¹ê²{¥Ø¿ý¸Ñ°£¹Lµ{¤¤¡A»·¤£¦p«Ø¥ß¥Ø¿ý¨º»ò¶¶§Q¡C¸I¨ìªº°ÝÃD¬O:

¡@¡@1.RmDir¤£¤¹³\¸Ñ°£¥Ø«e¤u§@¥Ø¿ý¡C¦ý¬°¤F¾Þ§@¤è«K¡A§Ú­Ì­n¨D¸Ñ°£ªº«ê«ê¬O¥Ø«e¤u§@¥Ø¿ý¡F

¡@¡@2.¥Ø¿ý¸Ñ°£«á©I¥sRefresh¤èªk©ÎUpdate¤èªk¨Ã¤£¯à¨Ï¸Ó¥Ø¿ý±q¿Ã¹õÅã¥Ü¤¤¥h°£¡C¦]¦Ó·í¥Î¤á¸Õ¹Ï¶i¤J¸Ó¥Ø¿ý®É·|¾É­P¨t²Î±Y¼ì¡C

¡@¡@¹ï²Ä¤@­Ó°ÝÃD¡A§Ú­Ìªº¸Ñ¨M¿ìªk¬O§â¥Ø«e¤u§@¥Ø¿ýÂà´«¨ì¨ä¤÷¥Ø¿ý¡C°²¦pŪªÌ°O±o¥Ø¿ý¤]³Q§@·~¨t²Î§@¬°¤@ºØ¯S®íªº¤å¥ó¹ï«Ýªº¸Ü¡A¨º»ò´N¤£·|¹ï¤U­±ªº»y¥y·P¨ì©_©Ç¤F¡G¡@

¡@¡@path := DirectoryOutline.Directory;

¡@¡@Directoryoutlin.Directory := ExpandFilePath(Path);

¡@¡@¦Ó«á©I¥sRmDir¹Lµ{¡G¡@

RmDir(Path)¡F

¡@

¡@¡@²Ä¤G­Ó°ÝÃDªº¸Ñ¨M«o»á¬°¶O¯«¡C¦]¬°DirectoryOutline¬ODelphi´£¨Ñªº¥Ü¨Ò³¡¥ó¡A¨S¦³Help¤å¥ó¤ä´©¡C³q¹L¸ÕÅçµo²{¡G¥u¦³·íDirectoryOutlineªºDriveÄݩʧïÅܮɡA¤~­«·s±q¬ÛÀ³ºÏºÐ¾÷Ū¨ú¥Ø¿ý¡C¦Ó¥B¥¦°ò¥»¤W¬O°ßŪªº¡A°£«D²M°£( Clear) ¥¦¡A¶HAdd¡BDelete³o¨Ç¤èªk¹ï¥¦³£¬OµL®Äªº¡C

¡@¡@§Ú´¿¸g¦Ò¼{¹L¤@­Ó²Â©åªº¤èªk¡A¨º´N¬O¥ý§ïÅܥثeºÏºÐ¾÷¦Ó«á¦A§ï¦^¨Ó¡C¦ý³oºØ¤èªk¤@¤è­±³t«×µLªk§Ô¨ü¡A¥t¤@¤è­±·í¥u¦s¦b¤@­ÓºÏºÐ¾÷¥i¥Î®É·|¾É­P¨t²Î±Y¼ì¡C

¡@¡@¥¿·í§Ú¤@Äw²ö®i®É¡A¬ðµM·Q¨ì¡GDirectoryOutline¬O¤@­ÓSample³¡¥ó¡ADelphi ´£¨Ñ¤F¥¦ªº·½¥N½X¡C¦Ó·í§Ú¤ÀªR¤F¥¦ªº·½¥N½X«á¡A§Úª¾¹DÀ³¸Ó°µ¤°»ò¤F¡A¨º´N¬O¬°DirectoryOutline¼W²K¤@­ÓReset¤èªk!¡@

6.7.3 ¬°³¡¥ó¼W²K¤@­Ó¤èªk¡@

¡@¡@ÄY®æ¦a»¡¡A§Ú­Ì©Ò°µªº¤u§@ÄÝ©ó«Ø¥ß¤@­Ó·s³¡¥ó¡C¦ý¦]¬°§Ú­Ì¦³·½¥N½X¡A©Ò¥H¤£¥²±qDirectoryOutlineÄ~©Ó¦Ó¬Oª½±µ­×§ï¥¦¡C³o¼Ë§Ú­Ì¥i¥H¬Ù¥h»P«Ø¥ß³¡¥ó¦³Ãöªº³\¦hÁcº¾¤u§@¡C¹ï«Ø¥ß·s³¡¥ó·P¿³½ìªºÅªªÌ¥i¾\Ū¥»®Ñ²Ä¤T½sªº¦³Ãö³¹¸`¡C

¡@¡@¦bDelphi IDE¤¤¥´¶}DirectoryOutlineªº·½¤å¥ó«á¡G

1.§â®w³æ¤¸¦W§ï¬°DirPlus¡AÃþ¦W§ï¬°TDirectoryOutlinePlus¡Aªí©ú³o¬ODirectoryOutlineªº¼W±jª©¡C¦Ó«á¦s¤J¥t¤@­Ó¥Ø¿ý¤¤¡F

¡@ 2.¥[¤J¤@­Ó¤½¦³¤èªkReset¡C³o¤@¤èªkªº§@¥Î¬O­«·sŪ¨ú¥Ø«eºÏºÐ¾÷ªº¥Ø¿ý¡Cµ{¦¡²M³æ¦p¤U¡C¡@

procedure TDirectoryOutlinePlus.Reset;

begin

ChDir(FDrive + ':');

GetDir(0, FDirectory);

FDirectory := ForceCase(FDirectory);

if not (csLoading in ComponentState) then BuildTree;

end;

¡@¡@ŪªÌ¤]³\³Q³o¬q¥N½X§Ë½k¶î¤F¡C¥Ñ©ó½g´T©Ò­­¡A¦Ó¥B¯A¤Î¨ì³\¦h¦Û©w¸q³¡¥ó¶}µoªº¤º®e¡A§Ú­Ì¤]¤£·Ç³Æ¥h¸Ô²Ó¸ÑÄÀ¥¦¡C°²¦pŪªÌ·Q¹ý©³·dÀ´¥¦¡A§Ú«Øij¥ý¬Ý¤@¤U¥»®Ñ²Ä¤T½s¦³Ãö¦Û©w¸q³¡¥ó¶}µoªº¤º®e¡A¦Ó«á¦A¹ï·Ó­ìDirectoryOutlineªº·½¥N½X¶i¦æ¤ÀªR¡C

¡@¡@3.½sĶ¦¨¤@­Ó®w¤å¥óDirPlus.tpu;

4.§âDirPlus¥[¤J³¡¥óªºSamples­¶¤¤¡C

¡@¡@¦p¦ó¥[¤J¤@­Ó³¡¥ó¨£²Ä¤T½s¦³Ãö³¹¸`ªº¤¶²Ð¡C

¡@¡@·í¼W±jªº¥Ø¿ý¾ð·Ç³Æ¦n¥H«á¡A¥²¶·­×§ï§Ú­Ìªº¤lµøµ¡³]­p¡A¦ý«o¤£¥²¿Ë¦Û­×§ï·½¥N½X¡C

¡@¡@1.¸Ñ°£¤lµøµ¡¤¤ªºTDirectoryOutlineÃþ³¡¥óDirectoryOutline¡C¦¹®ÉFileList¦û¾Ú¤F¾ã­Ó¥Î¤á°Ï¡F

¡@¡@2.§âFileListªºAlignÄݧאּNone¡A¨Ã¯d¥X¥ªÃ䪺ªÅ¥Õ¨Ñ©ñ³¡¥ó¥Î¡F

¡@¡@3.¦bµøµ¡¥ª³¡¥[¤JTDirectoryOutlinPlusÃþªº³¡¥óDirectoryOutline¡F

4.§âDirectoryOutlineªºAlignÄݩʧאּLeft¡AFileListªºAlignÄÝ©ÊÁ٭쬰Client¡F

5.¦bDirectoryOutlineªº¨Æ¥óOnChange²M³æ¤¤¿ï¨úDirectoryOutlineChange¡A§Y­ìDirectoryOutlineªº³B²z¹Lµ{¡C

¡@¡@¥H¤W¤u§@ªº³Ì²×¥Ø¼Ð¬O¹ê²{¥Ø¿ý«Ø¥ß¡B¸Ñ°£«á¿Ã¹õªº¥¿½TÅã¥Ü¡C³o¥u»Ý­n©I¥sDirectoryOutlineªºReset¤èªk§Y¥i¡C

¥Ø¿ý¸Ñ°£¹Lµ{ªº¹ê²{¥N½X¦p¤U¡C¡@

procedure TFMForm.DeleteDirectory1Click(Sender: TObject);

var

path: String;

k: Integer;

begin

{$I-}

path := DirectoryOutline.Directory;

DirectoryOutline.Directory := ExtractFilePath(Path);

if MessageDlg('Delete ' + path + '?', mtConfirmation,[mbYes, mbNo], 0) = idYes then

RmDir(path);

if IOResult <> 0 then

MessageDlg(' Cannot remove directory! The path might not'+

'exist,non-empty or is the current logged directory.',mtWarning,[mbOk], 0)

else

DirectoryOutline.Reset;

end;

­×§ï«áªº¥Ø¿ý«Ø¥ß¹Lµ{¦p¤U¡C¡@

procedure TFMForm.CreateDirectory1Click(Sender: TObject);

var

NewDir: TNewDir;

Dir: String;

begin

{$I-}

NewDir := TNewDir.Create(self);

with NewDir do

begin

CurrentDir.Caption := DirectoryOutline.Directory;

if (ShowModal <> idCancel) and (DirName.Text <> '') then

Dir := ExpandFileName(DirName.text);

end;

MkDir(Dir);

if IOResult <> 0 then

MessageDlg('Cannot Create directory', mtWarning, [mbOk], 0)

else

DirectoryOutline.Reset;

end;

¡@¡@·í§¹¦¨¤F³o¨Ç¤u§@¡A§âµ{¦¡­«·s½sĶ¡B°õ¦æ«á¡A¥i¥Hµo²{§Ú­Ì©Ò§Æ±æ¹ê²{ªº¥\¯à§¹¥þ¹ê²{¤F¡I¦P®É¡A§Ú­Ì¦³¤F¤@­Ó§ó¦nªº¥Ø¿ý¾ð³¡¥ó¡C¡@

6.4.7.4 §ïÅܥثe¤u§@¥Ø¿ý¡@

¡@¡@§ïÅܥثe¤u§@¥Ø¿ýªº¹ê²{«D±`²³æ¡A¥u­n­×§ïDirectoryOutlineªºDirectoryÄÝ©Ê¡C¦ý»Ýª`·Nªº¬O¡G·í§ïÅÜ«á¥Ø¿ý©Ò¦bºÏºÐ¾÷¤]µo¥ÍÅܤƮÉÀ³¬ÛÀ³­×§ïDriveTabSetªº¥Ø«e­È¡C¥Ñ©óºÏºÐ¾÷¦W»PDriveTabSetªº¯Á¤ÞÄÝ©ÊTabIndex¤§¶¡¨Ã¨S¦³½T©wªº¹ïÀ³Ãö«Y¡A¦]¦Ó»Ý­n³q¹L¤@­Ó¦^°é¶i¦æ§ä¨ì¤Ç°t¡C

Change Directoryªº¿ï¾Üªí¨Æ¥ó³B²z¹Lµ{¬OFileChange¡A§Y»P¤å¥óªº²¾°Ê¡B«þ¨©¡B§ó¦W¦@¥Î¤@­Ó¨Æ¥ó³B²z¹Lµ{¡C¸Ô²Ó±¡ªp½ÐŪªÌ°Ñ¬Ý(6.4.5.3)¤¤ªº¤¶²Ð¡C

§ïÅܥثe¤u§@¥Ø¿ýªº¹ê²{¦p¤U¡C¡@

procedure TFMForm.ChangeDirectory(Todir: String);

var

i: Integer;

begin

{$I-}

ChDir(ToDir);

if IOResult <> 0 then

MessageDlg('Cannot find directory', mtWarning, [mbOk], 0)

else

begin

with DirectoryOutline do

begin

Directory := ToDir;

Refresh;

if DriveTabSet.Tabs[DriveTabSet.TabIndex][1]<>drive then

for I := 1 to 25 do

if DriveTabSet.Tabs[i][1] = drive then

begin

DriveTabSet.TabIndex := i;

Exit;

end;

end;

end;

end;

6.4.8 ¤@¨Ç°ÝÃDªº³B²z¡@

6.4.8.1 ¤lµøµ¡ªº¼ÐÃD¡@

¡@¡@Windowsªº¤å¥óºÞ²z¾¹¬O§Ú­Ì³]­pªº·¢¼Ò¡A¦b¤lµøµ¡Åã¥Ü¼ÐÃD¤W¤]¤£¨Ò¥~¡C§Ú­Ì§â¥Ø«e¤u§@¥Ø¿ý¥[¤W¤å¥óªº«¬¦¡§@¬°¤lµøµ¡ªº¼ÐÃD¡C

¹Lµ{CreateCaption¥Î©ó²£¥Í¤lµøµ¡ªº¼ÐÃD¡C¡@

procedure TFMForm.CreateCaption;

var

Cap: String;

begin

Cap := DirectoryOutline.Directory;

Cap := cap+'\'+FileList.mask;

Caption := Cap;

end;¡@

         ¥Ø«e¤u§@¥Ø¿ý©Î¤å¥óÅã¥Ü«¬¦¡µo¥ÍÅܤƮɧïÅܤlµøµ¡ªº¼ÐÃD¡C¦pDirectoryOutlineªºChange¨Æ¥ó³B²z¹Lµ{©MViewType¿ï¾Üªí¶µªºClick¨Æ¥ó³B²z¹Lµ{´N©I¥s¤F¸Ó¹Lµ{¡C¡@

6.4.8.2 ª¬ºA±øªºÅã¥Ü¡@

¡@¡@ª¬ºA±ø¥Î©óÅã¥Ü¥Ø«e¤u§@¥Ø¿ý©M¥Ø«e¿ï¤¤¤å¥ó¡C¥¦­Ìªº­È¦bDirectoryOutline ©MFileListªºChange¨Æ¥ó³B²z¹Lµ{¤¤­×§ï¡C

¡@¡@DirectoryOutline©MFileList³Ì²×ªºChange¨Æ¥ó³B²z¹Lµ{¦p¤U¡G¡@

procedure TFMForm.DirectoryOutlineChange(Sender: TObject);

begin

CreateCaption;

FileList.clear;

FileList.Directory := DirectoryOutline.Directory;

FileList.Update;

FileManager.DirectoryPanel.Caption := DirectoryOutline.Directory;

end;

procedure TFMForm.FileListChange(Sender: TObject);

begin

with FileList do

begin

if (ItemIndex >= 0) and (Not HasAttr(FileName,faDirectory)) then

begin

TheFileName := FileName;

FileManager.FilePanel.Caption :=

Format('%s, %d bytes', [TheFileName, GetFileSize(TheFileName)]);

end

else

FileManager.FilePanel.Caption := '';

end;

end;¡@

6.4.8.3 ª©¥»¸ê°T¡@

¡@¡@·í¥Î¤á«ö¤@¤U¥Dµøµ¡ªºHelp|About¿ï¾Üªí¶µ®É±N¼u¥X¤@­ÓAbout¹ï¸Ü¤è¶ô¡A¥Î©óÅã¥Üª©¥»¸ê°T¡]¦p¹Ï6.13¡^¡C

¡@¡@³o¤@¹ï¸Ü¤è¶ô¬O¥ÎDelphi´£¨Ñªº¼ÒªO°µªº¡C

6.4.8.4 ¿ï¾Üªí¶µªºÅܦǻP¨Ï¯à¡@

¡@¡@File¿ï¾Üªí¤¤©w¸qªº¤å¥óºÞ²z¥\¯à¥u¦³·í¬¡°ÊµJÂI¦bFileList(§Y¦³¥Ø«e¿ï¤¤¤å¥ó)®É¤~°_§@¥Î¡C§_«h©Ò¦³¿ï¾Üªí¶µÀ³ÅܦǡA¥H§K¾É­P¨t²Î±Y¼ì¡C

¡@¡@³o¤@¥\¯à¦bFile¿ï¾ÜªíªºClick¨Æ¥ó³B²z¹Lµ{¤¤¹ê²{¡C³o¤@ÂI¨Ã¤£«Ü®e©ö³Q¤H·Q¨ì¡A§Æ±æŪªÌ¯à±q¤¤¨ü¨ì±Òµo¡C¡@

procedure TFMForm.File1Click(Sender: TObject);

var

FileSelected: Boolean;

begin

FileSelected := FileList.ItemIndex >= 0;

Open1.Enabled := FileSelected;

Delete1.Enabled := FileSelected;

Copy1.Enabled := FileSelected;

Move1.Enabled := FileSelected;

Rename1.Enabled := FileSelected;

Properties1.Enabled := FileSelected;

end;

¡@¡@§PÂ_¬O§_¦³¤å¥ó³Q¿ï¤¤¬O³q¹L°»´úItemIndexÄݩʬO§_¤j©óµ¥©ó0¨Ó¹ê²{ªº¡C

¡@¡@ FileSelected := FileList.ItemIndex >= 0¡F¡@

6.4.8.5 ¥i­«¥Îªº¤å¥ó³B²z¼Ò¸s²Õ¡@

¡@¡@®w³æ¤¸fmxutils¬O¤@­Ó¥N½X®w¡A´£¨Ñ¤F­Y¤z¤å¥ó³B²z¼Ò¸s²Õ¡C³o¨Ç¼Ò¸s²Õ°£¦b¥»µ{¦¡¤¤¨Ï¥Î¥~¡AŪªÌ¥i¥H¦b¨ä¥¦À³¥Îµ{¦¡¤¤ª½±µ©I¥s¡A¦Ó¥B¤£¥²­«·s½sĶ¡A¥u­n¦bUses¤l¥y¤¤¥]§t§Y¥i¡C±q¤¤§Ú­Ì¥i¥HÅé·|¨ì¡ADelphi ¥H®w³æ¤¸¬°¤¤¤ßªºµ{¦¡¸s¸s²Õ´¤è¦¡´£¨Ñ¤F¤@ºØ¸û§¹µ½ªº¥N½X­«¥Î¾÷¨î¡C¡@

6.4.9 ¤pµ²¡@

¡@¡@¤å¥óºÞ²z¾¹¬O¤@­Ó¸û¬°ºî¦Xªº¨Òµ{¡A¨Ï¥Î¨ì¤Fµ´¤j³¡¤À¥HÀÉ®×¼Ðñ¡B¤å¥ó¥y¬`¥H¤Î¨ä¥¦°Ñ¼Æ(°£¤å¥óÅܼÆ)¬°¾Þ§@ª«¥óªº¤å¥óºÞ²z¹Lµ{/¨ç¼Æ¡A¦P®É¤]´£¨Ñ¤F¤@¨Çµ{¦¡³]­p¶}µoªº«ä·Q¡C§Ú­Ìªº¤¶²Ð¬O¥Hµ{¦¡¥\¯à¼Ò¸s²Õ¨Ó¸s¸s²Õ´ªº¡A§Ú«ØijŪªÌ¦b¾Ç²ß¨Ã¸Õ¹Ï¦Û¤v«Ø¥ß³o¤@µ{¦¡®É±Ä¥Î¦P¼Ëªº¤èªk¡C(6.4.8)¤¤ªº¤º®e©Î³\¬O¤@¶}©l´NÀ³¤F¸Ñªº¡A¦ý¨ä¥¦§¹¥þ¥i¥H«ö¶¶§Ç³v¨B¦aÂX¥R¡A³Ì«á±o¨ì¤@­Ó§¹¾ãªºµ{¦¡¡C³o¤@¨Òµ{¦b«áÃ䪺©ì©ñ¾Þ§@©M²§±`³B²zµ¥³¹¸`¤¤ÁÙ­n¥Î¨ì¡CŪªÌ¥i¥H¥H¦¹¬°°ò¦¶i¤@¨B§¹µ½¥¦¡A¨Ï¥¦¯u¥¿¦¨¬°¤@­Ó§¹¥þ¹ê¥Îªºµ{¦¡¡C

¡@¡@¤å¥óºÞ²z¬O¦b¶}µo¤@­Ó¶i¶¥ªºWindowsµ{¦¡¤¤¤£¥iÁקKªº­n¯A¤Î¨ìªº°ÝÃD¡C¥»³¹¤¶²Ðªº«ä¸ô©M¤èªk±N¬°ÅªªÌ¦¨¬°¤@­Ó¼ô½mªºµ{¦¡­û³þ©w°ò¦¡C



«á¤@­¶
«e¤@­¶
¦^¥Ø¿ý
¦^­º­¶