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

6.2.7 °O¿ýªº¸Ñ°£¡B´¡¤J¡B±Æ§Ç¡@

¡@¡@¸Ñ°£¤@±ø°O¿ýªº°ò¥»«ä¸ô¬O¡GÀò¨ú¥Ø«e°O¿ýªº¦ì¸m¨Ã§â¸Ó¦ì¸m«áªº°O¿ý³v­Ó¦V«e²¾°Ê¡C ¤å¥ó¦b³Ì«á¤@±ø°O¿ý«eºIÂ_¡C¡@

¡@¡@for i:=CurrentRec+1 to Count-1 do

begin

seek(MethodFile,i);

read(MethodFile,MethodRec);

seek(MethodFile,i-1);

Write(MethodFile,MethodRec);

end;

Truncate(MethodFile);¡@

          ¬°ÁקK»~¸Ñ°£¡A¦b¶i¦æ¸Ñ°£¾Þ§@«e¼u¥X¤@­Ó°T®§®Ø¶i¦æ½T»{¡C¸Ñ°£«á­n§ó·s¥þ§½Åܼƪº­È©MÅã¥Ü¤º®e¡G¡@

Count := Count - 1;

ChangeGrid;¡@

           §¹¾ãªºµ{¦¡¦p¤U¡G¡@

procedure TRecFileForm.DeleteButtonClick(Sender: TObject);

var

NewFile: MethodFileType;

MethodRec: TMethod;

NewFileName: String;

i: Integer;

begin

if FileOpened = False then Exit;

CurrentRec := StringGrid1.Row-1;

if CurrentRec < 0 then Exit;

if MessageDlg('Delete Current Record ?', mtConfirmation,

[mbYes, mbNo], 0) = idYes then

begin

HazAttr.text := '';

for I := CurrentRec+1 to Count-1 do

begin

seek(MethodFile,i);

read(MethodFile,MethodRec);

seek(MethodFile,i-1);

Write(MethodFile,MethodRec);

end;

Truncate(MethodFile);

Count := Count-1;

ChangeGrid;

end;

end;

¡@¡@³oùØ©ÒÅã¥Üªº¸Ñ°£¾Þ§@²³æ©ú¤F¡C¦ý¦bµ{¦¡¶}©l³]­p®É§Ú«o¨«¤F¤@±øÅs¸ô¡A«á¨Óµo²{ÁöµM³oºØ¤èªk¥Î©ó°O¿ýªº¸Ñ°£¾Þ§@Åã±o²Â©å¡B¥i¯º¡A¦ý«o«ê«ê¬O°O¿ý´¡¤J¡B±Æ§Çªº«ä·Q¡C

¡@¡@³oºØ«ä·Qªº®Ö¤ß¬O«Ø¥ß¤@­Ó·s¤å¥ó¦sÀɧó·s«áªº¤º®e¡C­Y·s¤å¥ó¶¶§Q«Ø¥ß¡A«h¸Ñ°£­ì¤å¥ó¡A§_«h«ì´_­ì¨Óªº¤å¥ó¡Cµ{¦¡²M³æ¦p¤U¡G¡@

procedure TRecFileForm.DeleteButtonClick(Sender: TObject);

var

NewFile: MethodFileType;

MethodRec: TMethod;

NewFileName: String;

i: Integer;

begin

if FileOpened = False then Exit;

CurrentRec := StringGrid1.Row-1;

if CurrentRec < 0 then Exit;

if MessageDlg('Delete Current Record ?', mtConfirmation,

[mbYes, mbNo], 0) = idYes then

begin

HazAttr.text := '';

NewFileName := ChangeFileExt(FileName,'.sav');

try

AssignFile(NewFile,FileName);

ReWrite(NewFile);

Except

On EInOutError do

begin

Rename(MethodFile,FileName);

Exit;

end;

end;

for i := 1 to Count do

if I <> CurrentRec+1 then

begin

MethodRec := GridToRec(i);

Write(NewFile,MethodRec);

end;

closeFile(MethodFile);

try

AssignFile(MethodFile,Filename);

Reset(MethodFile);

except

on EInOutError do

begin

DeleteFile(FileName);

AssignFile(MethodFile,NewFileName);

Reset(MethodFile);

Rename(MethodFile,FileName);

Exit;

end;

DeleteFile(NewFileName);

Count:=Count-1;

ChangeGrid;

end;

end;

¡@¡@¹ï©ó°O¿ý´¡¤J¡A¤èªk°ò¥»¦P¤W¡C¹ï©ó±Æ§Ç¡A¥i¥ý±NÃöÁäÄæ¦ìŪ¤J±Æ§Ç¡A¦Ó«á¦A«ö±Æ§Çµ²ªG¹ïÀ³ªº°O¿ý¸¹¶¶§Ç­«¼g¤å¥ó¡C¡@

6.2.8 µ²ªGºî¦X¡@

¡@¡@¹ï¤£¦P¤èªkªºµû¦ôµ²ªG¡A¥i«ö¤@©wªº¤½¦¡¶i¦æºî¦X¡C·í¥Î¤á«ö¤U¡§­pºâ¡¨«ö¶s®É¡A¨t²Î¶i¦æ­pºâ¨Ã§âºî¦Xµ²ªG¼g¤JHazAttr°ßŪ½s¿è®Ø¤¤¡C

¡@¡@¬°«OÃÒµ²ªGÅã¥Üªº¥¿½T©Ê¡A¨C¦¸¼W¥[¡B­×§ï¡B¸Ñ°£¾Þ§@½T»{«áHazAttr½s¿è®Ø²MªÅ¡C¡@

6.2.9 ½s¿è¹ï¸Ü¤è¶ôªº¿é¤JÀˬd¡@

¡@¡@·í¥Î¤á«ö¤@¤U¡§¼W¥[¡¨©Î¡§­×§ï¡¨«ö¶s®É¨t²Î±N¼u¥X¤@­Ó½s¿è¹ï¸Ü¤è¶ô¡AÅý¥Î¤á¿é¤J©Î­×§ï°O¿ý¤º®e¡C¨ä¤¤ªº¤T­Ó½s¿è®Ø¡A¤@­Ó¸s¸s²Õ¦X¦C¥Ü¤è¶ô¤À§O¹ïÀ³TMethod ªº¥|­ÓÄæ¦ì¡C¥Ñ©óTMethodªºResultÄæ¦ì¥²¶·¬O[0,1]¶¡ªº¤p¼Æ¡A¦]¦¹·í¥Î¤á«öOKÁäÃö³¬¹ï¸Ü¤è¶ô®ÉÀ³¶i¦æ«¬¦¡©M½d³òÀˬd¡C

¡@¡@¦bVB¤¤§Ú°µ¹L¦P¼Ëªº¤u§@¡A¨º®É»Ý­n¹ï¥Î¤á¿é¤JªºÁä½X³v­Ó¶i¦æ§PÂ_¡C¦ý³oºØ¤èªk«ÜÁcº¾¡B«ÜÃø°µ¶êº¡(¦p¤£¯à«Ü¦n¦a¤ä´©½s¿èÁä)¡C¦ÓObject Pascal´£¨Ñ¤F§ó¦nªº¤èªk¡C³oºØ¤èªkªºÃöÁä´N¦b©ó¥¦ªº«¬¦¡Âà´«¨ç¼ÆVal¡G¡@

procedure Val(Str: String;var V; var Code: Integer)¡F¡@

¡@¡@V¬O¥ÑStrÂà´«¦¨ªº¾ã«¬©Î¹ê«¬¼Æ¡C­Y¦r¤¸¦ê«Dªk¡A«h¥X¿ù¦ì¸mªð¦ÜCode;§_«h¸mCode¬°0¡C¦r¤¸¦ê«Dªk¨Ã¤£·|¤Þµo¤@­ÓÂà´«²§±`¡C

¡@¡@¦pªGÂà´««áªº¼Æ¶W¥X¤F§Ú­Ìªº½d³ò¡A«hÅ㦡§âCode¸m¬°-1¡C³Ì«á²Î¤@³q¹L°»´úCode¬O§_¬°0¨Ó§PÂ_¿é¤J¬O§_¦Xªk¡C

¡@¡@§Ú­Ì§â¿é¤JÀˬd©ñ¦b¹ï¸Ü¤è¶ôªºOnCloseQuery¨Æ¥ó³B²z¹Lµ{¤¤¡C¦p¿é¤J«Dªk¡A«h¸T¤î¹ï¸Ü¤è¶ôÃö³¬¡A¨Ã±N¿é¤JµJÂI¸m©óResult½s¿è®Ø¤¤¡C¦ý°²¦p¥Î¤á«ö¤FCancel«ö¶s¡A«h³oºØÀˬd¬O¦h¾lªº¡C¬°¦¹©w¸q¤@­Ó¥¬º¸ÅܼÆIsCancel¡A¹ï¸Ü¤è¶ô²£¥Í®É¸m¬°False¡C°²¦p¥Î¤á«ö¤UCancel¡A«h¸m¬°True¡A¦¹®ÉOnCloseQuery¨Æ¥ó¤£¶i¦æ¿é¤JÀˬd¡C

¡@¡@¹ï¸Ü¤è¶ôªºOnCloseQuery¨Æ¥ó³B²z¹Lµ{ªºµ{¦¡²M³æ¦p¤U¡G¡@

procedure TEditForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);

var

Res: Real;

k: Integer;

begin

if IsCancel = False then

begin

val(Result.text,Res,k);

if (Res > 1) or (Res < 0) then k := -1;

if k <> 0 then

begin

MessageDlg('«Dªk¿é¤J ¡I',mtWarning,[mbOK],0);

Result.text := '';

CanClose := False;

Result.SetFocus;

end;

end;

end;¡@

6.2.10 ¤å¥ó©M¨t²ÎªºÃö³¬¡@

¡@¡@¤å¥óÃö³¬¶·©I¥sCloseFile¹Lµ{¡G¡@

¡@¡@ CloseFile(MethodFile);¡@

¨Ã¹ï¨t²Îªºª¬ºA­«·s¶i¦æ³]©w¡C

          ¨t²ÎÃö³¬®É­º¥ý°»´ú¥Ø«e¬O§_¦³¥´¶}ªº¤å¥ó¡C­Y¦³«h¥ýÃö³¬¤å¥ó¡C³o¦b¥Dµøµ¡ªºOnCloseQuery¨Æ¥ó¤¤¹ê²{¡C

¹ê²{¤å¥óÃö³¬ªºµ{¦¡²M³æ¦p¤U¡G¡@

procedure TRecFileForm.CloseButtonClick(Sender: TObject);

begin

if FileOpened then

begin

CloseFile(MethodFile);

FileOpened := False;

ClearGrid;

OpenButton.Enabled := True;

NewButton.Enabled := True;

CloseButton.Enabled := False;

RecFileForm.Caption := FormCaption;

end;

end;¡@

¹ê²{¨t²ÎÃö³¬«eÀˬdªºµ{¦¡²M³æ¦p¤U¡G

procedure TRecFileForm.FormCloseQuery(Sender: TObject;

var CanClose: Boolean);

begin

if FileOpened then

closeFile(MethodFile);

end;¡@

6.2.11 °O¿ý¤å¥ó¤pµ²¡@

¡@¡@§Ú­Ì©ÒÁ|ªº¨Ò¤lÁöµM²³æ¡A¦ý°ò¥»Âл\¤F°O¿ý¤å¥ó¾Þ§@ªº¥D­n¤è­±¡C³oùØÃöÁä°ÝÃD¦b©óÆF¬¡À³¥ÎDelphi´£¨Ñªº¤å¥óºÞ²z¨ç¼Æ¡C¦P®É¡A¬°¤F«OÃÒµ{¦¡ªº°·§§©ÊÀ³¹ï²§±`¶i¦æ®·Àò¨Ã³B²z¡C¦b¸ê®Æ®wÀ³¥Î§Þ³Nµo®iªº¤µ¤Ñ¡A°O¿ý¤å¥óªº­«­n©Ê¤]³\¦³©Ò¤U­°¡A¦ýª«¥ó§Ú­Ì³oùØ©Ò³B²zªºÂ²³æ°ÝÃD¥¦¤´¦³¥ÎªZ¤§¦a¡C

¡@¡@³oùØ©ÒÁ|ªº¨Ò¤l¤@¦¸¥u¯à³B²z¤@­Ó¤å¥ó¡C¦ýŪªÌ¥i¥H«Ü®e©ö§â¥¦§ï¬°¤@­ÓMDIµ{¦¡¡CÁöµM¹ï©ó³oùتº¹ê»Ú±¡ªp¨Ó»¡¡A¦ü¥G¨ÃµL¥²­n¡C¡@

6.3 ¤å¥ó±±¥óªºÀ³¥Î¡@

¡@¡@Delphi¤å¥óºÞ²zªº³Ì¤j¯S¦â¬O´£¨Ñ¤F¤@¸s¸s²Õ¤å¥ó¾Þ§@±±¥ó¡C§Q¥Î³o¨Ç±±¥ó§Ú­Ì¥i¥H§Ö³t¶}µo¤@­ÓÀÉ®×¼ÐñÂsÄý¨t²Î¡C¨ä¥\¯à±j¤j»P¨ä©Ò»Ý®Ñ¼g¥N½X¤§¤Ö©Ò§Î¦¨ªº±j¯P¤Ï®t¡A¥¿¬ODephi¥Í©R¤OªºÅé²{¡C¡@

6.3.1 ¤å¥ó±±¥ó¤Î¨ä¬Û¤¬Ãö«Y¡@

¡@¡@Delphi´£¨Ñªº±M¥Î¤å¥ó±±¥ó¦p¤Uªí©Ò¥Ü¡C¡@

¡@¡@ ªí6.4 Delphi±M¥Î¤å¥ó±±¥ó¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w

±±¥ó¦W ¥\ ¯à

¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X

DriveComboBox ºÏºÐ¾÷¸s¸s²Õ¦X¦C¥Ü¤è¶ô¡C¥Î©ó¿ï¾Ü¥Ø«eºÏºÐ¾÷

FileListBox ¤å¥ó¦C¥Ü¤è¶ô¡C¥Î©óÅã¥Ü¥Ø«e¤u§@¥Ø¿ý¤¤ªº¤å¥ó©M¿ï¤¤¥Ø«e¤å¥ó

FilterComboBox ¤å¥ó«¬¦¡¸s¸s²Õ¦X¦C¥Ü¤è¶ô¡C¥Î©ó¿ï¾ÜÅã¥Ü¤å¥óªº«¬¦¡

DirectoryOutline ¥Ø¿ý¾ð(6.4¸`±Mªù¤¶²Ð)

¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w

¡@¡@¥H¤W±±¥ó«e¥|­Ó¦bComponent Palette(³¡¥ó¿ï¾ÜªO)ªºSystem­¶¤¤¡ADirectoryOutline¦bComponent PaletteªºSamples­¶¤¤¡C

¡@¡@¥H¤W¤å¥ó±±¥ó¦A¥[¤W¤å¥ó½s¿è®Ø¡B¥Ø¿ý¼ÐÅÒ®Ø(¨Æ¹ê¤W¬O¤@¯ëªº½s¿è®Ø¡B¼ÐÅÒ®Ø)´N¥i¥Hºc¦¨¤@­Ó§¹¾ãªº¤å¥ó§@·~¨t²Î¡C¥¦­Ì¤§¶¡ªºÁpô´X¥G¤£¥Î¥N½X¤ä´©¡A¥u­n³]©w¦n¬ÛÀ³ªºÄÝ©Ê´N¥i¥H¤F¡C

¡@ FileEdit¡BDirLabel¡BFileListBox¡BFileFilterComloList¡B DirectoryListBox¡BDriveComboList¤»­Ó±±¥ó¶¡ªºÄÝ©ÊÁpô¦p¤U¡G¡@

¡@¡@DriveComboList .DirList := DirectoryListBox;

¡@¡@DirectoryListBox.DirLabel := DirLabel;

DirectoryListBox.FileList := FileListBox;

FileFilterComboList.FileList := FileListBox;

FileListBox.FileEdit := FileEdit;¡@

         ¥H¤WÁpô¥i¥H¦b³]­p®É§¹¦¨¡C¥u­n¥´¶}¬ÛÀ³Äݩʪº¿ï¾Ü¦C¥Ü¤è¶ô¶i¦æ¿ï¾Ü§Y¥i¡C¤]¥i¥H¦b°õ¦æ®É§Q¥Î¦p¤Wªº½á­È»y¥y«Ø¥ßÁpô¡C

¡@¡@¤å¥ó±±¥óªºÃöÁäÄÝ©Ê°ò¥»¤W³£¦b¥H¤WÁpô¤¤¤Ï¬M¥X¨Ó¤F¡C°£¦¹¤§¥~¡AFileFilterComboList¦³¤@­ÓFilterÄÝ©Ê¡A¥Î¨Ó³]©w¸s¸s²Õ¦X¦C¥Ü¤è¶ôªº¿ï¾Ü¶µ¡FFileListBox ¦³¤@­ÓMaskÄÝ©Ê¡A¥Î©ó³]©wÅã¥Ü¤å¥óªº«¬¦¡¡A³o´N¤¹³\FileListBox¦b²æÂ÷FileFilterComboList³æ¿WÀ³¥Î®É¤´¯à®Ú¾Ú»Ý­nÅã¥Ü¯S©wªº¤å¥ó¡C¦b6.4¸`¤¤§Ú­Ì±NÀ³¥Î³o¤@¥\¯à¡C

¡@¡@¤å¥ó±±¥óªº¤èªk¡B¨Æ¥ó°ò¥»¬O±qListBox©MComboBox¤¤Ä~©Óªº¡C¦ýFileListBox ¤¤¦³¤@­ÓApplyFilePath¤èªk«Ü¦³¥Î¡A§Ú­Ì±N¦b«áÃäµ¹¥X¨ä¥Îªk¡C¡@

6.3.2 ÀÉ®×¼ÐñÂsÄý§ä¨ì¨t²Îªº³]­p«ä¸ô¡@

¡@¡@§@¬°¤å¥ó±±¥óªºÀ³¥Î¹ê¨Ò¡A§Ú­Ì¶}µo¤F¤@­Ó²³æªºÀÉ®×¼ÐñÂsÄý§ä¨ì¨t²Î¡C³o­Ó¨t²Î¥i¥Î©óÀÉ®×¼ÐñªºÅã¥Ü¡A§â¿ï¤¤ªº¤å¥ó¼g¤J¦C¥Ü¤è¶ô¡A¨Ã¯à«ö¤å¥ó½s¿è®Ø¤¤¿é¤Jªº¸U¥Î¦r¤¸²Å¸¹¹ï¤å¥ó¶i¦æ§ä¨ì¡C

ªí6.5 ³¡¥óªº³]­p

¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w

³¡¥ó ÄÝ©Ê ¥\¯à

¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X

FileCtrForm Position=poDefault ¥Dµøµ¡

DirLabel Åã¥Ü¥Ø«e¤u§@¥Ø¿ý

FileEdit TabOrder=0 Åã¥Ü¥Ø«e¤å¥ó/¿é¤J¤å¥óÅã¥Ü¤Ç°t²Å

FileListBox1 FileEdit=FileEdit Åã¥Ü¥Ø«e¤u§@¥Ø¿ý¤å¥ó

DirectoryListBox1 DirLabel=DirLabel Åã¥Ü¥Ø«eºÏºÐ¾÷¥Ø¿ý

FileList= FileListBox1

DriveComboBox1 DirList= DirectoryListBox1 ¿ï¾Ü¥Ø«eºÏºÐ¾÷

FilterComboBox1 FileList=FileListBox1 ¿ï¾Ü¤å¥óÅã¥Ü«¬¦¡

Filter='All Files(*.*)|*.*|

Source Files(*.pas)|*.pas|

Form Files(*.dfm)|*.dfm|

Project Files(*.dpr)|*.dpr'

ListBox1 Åã¥Ü¿ï¤¤©Î§ä¨ìªº¤å¥ó

Button1 Caption='§ä¨ì' «ö FileEdit ¤¤ªº¤º®e¶i¦æ§ä¨ì

Button2 Caption='µ²§ô' µ²§ô¨t²Î

¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¡@

6.3.3 ÀÉ®×¼ÐñÂsÄý§ä¨ì¨t²Îªº¥\¯à©M¹ê²{¡@

6.3.3.1 «ö«ü©w«áºó¦WÅã¥Ü¥Ø«e¤u§@¥Ø¿ý¤¤ªº¤å¥ó¡@

¡@¡@¹ê²{³o¤@¥\¯à¥u»Ý­n¦b±±¥ó¶¡«Ø¥ß¥¿½TªºÁpô§Y¥i¡A¤£»Ý­n¥N½X¤ä´©¡C«Ø¥ßÁpôªº¤èªk¦p(6.3.1)¤¤ªº¤¶²Ð¡C¡@

6.3.3.2 §â¿ï¤¤ªº¤å¥ó¥[¤J¨ì¦C¥Ü¤è¶ô¤¤¡@

¡@¡@¦bFileListBox1ªºOnClick¨Æ¥ó¤¤¡G¡@

procedure TFileCtrForm.FileListBox1Click(Sender: TObject);

begin

if Searched then

begin

Searched := False;

ListBox1.Items.Clear;

Label5.Caption := 'Selected Files';

end;

if NotInList(ExtractFileName(FileListBox1.FileName),ListBox1.Items) then

ListBox1.Items.Add(ExtractFileName(FileListBox1.FileName));

end;

¡@¡@Searched¬O¤@­Ó¥þ§½ÅܼơA¥Î©ó¼Ð©úListBox1¥Ø«eÅã¥Ü¤º®e¬O§ä¨ìªºµ²ªGÁÙ¬O±qFileListBox1¤¤¤w¿ïªº¤å¥ó¡C

¨ç¼ÆNotInList¥Î©ó§PÂ_«Ý¥[¤Jªº¦r¤¸¦ê¬O§_¤w¦s¦b©ó¤@­ÓTStringsª«¥ó¤¤¡C¨ç¼Æªð¦^¤@­Ó¥¬º¸«¬ÅܼơC

¡@¡@NotInListªº¨ãÅé¹ê²{¦p¤U¡C¡@

Function TFileCtrForm.NotInList(FileName: String;Items: TStrings): Boolean;

var

i: Integer;

begin

for I := 0 to Items.Count-1 do

if Items[i] = FileName then

begin

NotInList := False;

Exit;

end;

NotInList := True;

end;¡@

6.3.3.3 «ö«ü©w¤Ç°t¦r¤¸¦êÅã¥Ü¥Ø«e¤u§@¥Ø¿ý¤¤ªº¤å¥ó¡@

¡@¡@·í¦bFileEdit¤¤¿é¤J¤@­Ó¤Ç°t¦r¤¸¦ê¡A¨Ã¦^¨®¡A¤å¥ó¦C¥Ü¤è¶ô±NÅã¥Ü¤Ç°tµ²ªG¡C³o¤@¥\¯à¦bFileEditªºOnKeyPress¨Æ¥ó¤¤¹ê²{¡C¡@

procedure TFileCtrForm.FileEditKeyPress(Sender: TObject; var Key: Char);

begin

if Key = #13 then

begin

FileListBox1.ApplyFilePath(FileEdit.Text);

Key := #0;

end;

end;

¡@¡@¤å¥ó¦C¥Ü¤è¶ô´£¨ÑªºApplyFilePath¤èªk¬O¸Ñ¨M³o¤@°ÝÃDªºÃöÁä©Ò¦b¡C¡@

6.3.3.4 «ö«ü©w¤Ç°t¦r¤¸¦ê§ä¨ì¥Ø«e¤u§@¥Ø¿ý¤¤ªº¤å¥ó¡@

¡@¡@¬°¤F¶i¦æ¤ñ¸û¡A§Ú­Ì¥Î¥t¤@ºØ¤èªk¨Ó¹ê²{¤å¥óªº§ä¨ì¥\¯à¡A§Y§Q¥Î¼Ð·Ç¹Lµ{FindFirst¡BFindNext¡CFileList1»PListBox1 ¤¤ªº¤º®e§¹¥þ¤@­P¡C

        ·í¥Î¤á«ö¤@¤U¡§§ä¨ì¡¨«ö¶s®É¡A»PFileEdit ¤¤¦r¤¸¦ê¬Û¤Ç°tªº¤å¥ó±NÅã¥Ü¦bListBox1¤¤¡C¤U­±¬O¹ê²{¥N½X¡C¡@

procedure TFileCtrForm.Button1Click(Sender: TObject);

var

i: Integer;

SearchRec: TSearchRec;

begin

Searched := True;

Label5.Caption := 'Search Result';

ListBox1.Items.Clear;

FindFirst(FileEdit.text,faAnyFile,SearchRec);

ListBox1.Items.Add(SearchRec.Name);

Repeat

i := FindNext(SearchRec);

If i = 0 then

ListBox1.Items.Add(SearchRec.Name);

until i <> 0;

end;

¡@¡@SearchRec¬O¤@­ÓTSearchRec«¬¦¡ªº°O¿ý¡CTSearchRecªº©w¸q¦p¤U¡G¡@

TSearchRec = record

Fill: array[1..21] of Byte;

Attr: Byte;

Time: Longint;

Size: Longint;

Name: string[12];

end;

¡@ ¦b³o¤@µ²ºc¤¤´£¨Ñ¤F«Ü¦h¸ê°T¡AÆF¬¡À³¥Î±Nµ¹µ{¦¡³]­p±a¨Ó«Ü¤j¤è«K¡C¤U­±§Ú­ÌÁ|´X­Ó¨Ò¤l¡C

¡@¡@1. °»´úµ¹©w¤å¥óªº¤j¤p¡C¡@

function GetFileSize(const FileName: String): LongInt;

var

SearchRec: TSearchRec;

begin

if FindFirst(ExpandFileName(FileName), faAnyFile, SearchRec) = 0 then

Result := SearchRec.Size

else

Result := -1;

end;¡@

³o¤@µ{¦¡±N¦b¤U¤@¸`¤¤À³¥Î¡C

¡@¡@2. Àò¨úµ¹©w¤å¥óªº®É¶¡ÂW¡A¨Æ¹ê¤Wµ¥»ù©óFileAge¨ç¼Æ¡C¡@

¡@¡@function GetFileTime(const FileName: String): Longint;

var

SearchRec: TSearchRec;

begin

if FindFirst(ExpandFileName(FileName),faAnyFile, SearchRec) = 0 then

Result := SearchRec.Time

else

Result := -1;

end;¡@

3. °»´ú¤å¥óªºÄÝ©Ê¡C¦pªG¤å¥ó¨ã¦³¬YºØÄÝ©Ê¡A«h¡@

SearchRec.Attr And GivenAttr > 0¡@

Äݩʱ`¼Æ¹ïÀ³ªº­È»P·N¸q¦p¤Uªí¡G¡@

¡@¡@ ªí6.6 Äݩʱ`¼Æ¹ïÀ³ªº­È»P·N¸q

¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w

±`¼Æ ­È ´y­z

¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X

faReadOnly $01 °ßŪ¤å¥ó

faHidden $02 ÁôÂäå¥ó

faSysFile $04 ¨t²Î¤å¥ó

faVolumeID $08 ¨÷¼Ð¤å¥ó

faDirectory $10 ¥Ø¿ý¤å¥ó

faArchive $20 Àɮפå¥ó

faAnyFile $3F ¥ô¦ó¤å¥ó

¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¡@

6.4 ¤å¥óºÞ²zºî¦XÁ|¨Ò¡G¤å¥óºÞ²z¾¹ªº¹ê²{¡@

¡@¡@¦b¥»³¹ªº³Ì«á¡A§Ú­Ì§Q¥ÎDelphi´£¨Ñªº¤å¥ó±±¥ó©M¤å¥óºÞ²z¨ç¼Æ¶}µo¤@­Ó²³æªº¤å¥óºÞ²z¾¹¡CÁöµM³o¤@¤å¥óºÞ²z¾¹ÁÙµLªk©MWindows´£¨Ñªº¤å¥óºÞ²z¾¹¬Û¤ñÀÀ¡A¦ý¥¦¤]¬°¤@¯ëªº¤å¥ó¾Þ§@´£¨Ñ¤F¨¬°÷¦hªº¥\¯à¡A¦Ó¥B¦pªGŪªÌ·P¿³½ì¡AÁÙ¥i¥H¹ï¥¦°µ¶i¤@¨BªºÂX¥R¡C¦b«áÃ䪺©ì©ñ¾Þ§@¤@³¹¤¤¡A§Ú­Ì´N¬°¥¦´£¨Ñ¤F©ì©ñ¤ä´©¡A¨Ï¥¦¬Ý°_¨Ó§ó¶H¤@­Ó¡§¤å¥óºÞ²z¾¹¡¨¡C

6.4.1 ³]­p°ò¥»«ä¸ô¡@

6.4.1.1 µøµ¡³]­p¡@

¡@¡@¤å¥óºÞ²z¾¹ªº¥Dµøµ¡¬O¤@­Ó¦h¤åÀɤ¶­±(MDI)¡C¦³Ãö¤å¥ó¡B¥Ø¿ýªºÅã¥Ü©M¤å¥óºÞ²z¥\¯àªº¹ê²{³£©ñ¦b¤lµøµ¡¤¤¡C¦bµ{¦¡°õ¦æ¹Lµ{¤¤±N®Ú¾Ú»Ý­n¼u¥X¤@¨Ç§¹¦¨¤£¦P¾Þ§@ªº¹ï¸Ü¤è¶ô¡C³o¨Ç¹ï¸Ü¤è¶ô³£¬O¦b»Ý­n®É°ÊºA²£¥Íªº¡Cªí6.7µ¹¥X¤F¥»µ{¦¡©Ò³]­pµ¡Å骺²M³æ¡C¡@

¡@¡@ ªí6.7 FileMangerµ¡Åé²M³æ

¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w

µ¡ÅéÃþ ¥\¯à ¥Î©ó«Ø¥ß¸ÓÃþµ¡Å骺¿ï¾Üªí¶µ

¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X

TFileManager ¥Dµøµ¡

TFMForm ¤lµøµ¡ Windows|New Window

TFileAttrForm Åã¥Ü¤å¥óÄÝ©Ê File|Properties;Function|Search

TChangeForm ¤å¥ó²¾°Ê¡B«þ¨©¡B§ï¦W¡B§ïÅÜ File|Move.Cope.Rename ¥Ø«e¤u§@¥Ø¿ýµ¥¾Þ§@ªº¿é¤J¹ï¸Ü¤è¶ô Directory|change Directory

TSearchForm ¿é¤J«Ý§ä¨ì¤å¥óªº¼Ðñ©M¸ô®| Function|Search

TDiskViewForm Åã¥ÜºÏºÐ¸ê°T Function|Disk View

TViewDir ¿é¤J«Ý«Ø¥ßªº¤l¥Ø¿ý Directory|CreateDirectory

TAboutBox Åã¥Üª©Åv¸ê°T Help|About

¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¡@

6.4.1.2 ¤¶­±³]­p¡@

¡@¡@¥Dµøµ¡¤¶­±¥D­n¬O¥D¿ï¾Üªí©M¥Î©óªí¥Ü¥Ø«e¤u§@¥Ø¿ý¡B¥Ø«e¤å¥óªºª¬ºA±ø¡C¡@

¡@¡@ ªí6.8 ¥Dµøµ¡¤¶­±³]­p

¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w

³¡¥ó ÄÝ©Ê ¥\¯à

¡@¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X

FileManager Style=fsMDI ¥Dµøµ¡

WindowMenu=Windows

Position=poDefault

MainMenu1 ¥D¿ï¾Üªí

FilePanel Align=alBottom Åã¥Ü¥Ø«e¿ï¤¤¤å¥ó

BevelInner=bvLowered

BevelWidth=2

DirectoryPanel Align=alBottom Åã¥Ü¥Ø«e¿ï¤¤¥Ø¿ý

Alignment=taLeftJustify

BevelInner=bvLowered

BevelWidth=2

¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w

¡@

¥Dµøµ¡¥D¿ï¾Üªí¥]¬AFile¡BWIndows¡BHelp¤T¶µ¡CFile¿ï¾Üªí¶µ¦b¤lµøµ¡²£¥Í®É³Q¤lµøµ¡¦P¦W¿ï¾Üªí¶µ©Ò¨ú¥N¡C³]©wWindows¡BHelpªºGroupIndex = 9¡A¥i¥H¨Ï¤lµøµ¡²£¥Í®É³o¨â­Ó¿ï¾Üªí¶µ¤´¦s¦b¡C

¡@¡@¤lµøµ¡¬ÉÄÑ¥]¬A¥D¿ï¾Üªí¡B¥Ø¿ý¾ð(DirectoryOutline)¡B¤å¥ó¦C¥Ü¤è¶ô¡B ¥Î©óÅã¥ÜºÏºÐ¾÷ªº¼ÐÅÒ¶°(TabSet)¥H¤Î¤T­Ó¥Î©óÅã¥ÜºÏºÐ¾÷«¬¦¡ªºTImage³¡¥ó¡C¡@

¡@ ªí6.9 ¤lµøµ¡¤¶­±³]­p

¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w

³¡¥ó ÄÝ©Ê ¥\¯à

¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X

FMForm ActiveControl=DirectoryOutline ¤lµøµ¡

Position=poDefault

Style=fsMDIChild

MainMenu1 ¥D¿ï¾Üªí

DriveTabSet Align=alTop Åã¥ÜºÏºÐ¾÷

style=tsOwnerDraw

DirectoryOutline Align=alLeft Åã¥Ü¥Ø«eºÏºÐ¾÷ªº¥Ø¿ý¾ð

options=[ooDrawTreeRoot,

ooDrawFocusRect,ooStretchBitmaps]

FileList Align=alClient Åã¥Ü¥Ø«e¤u§@¥Ø¿ý¤¤ªº¤å¥ó

FileType=[ftReadOnly,

ftHidden,ftSystem,ftArchive,ftNormal]

ShowGlyphs=True

Network(Image) Picture(Network.bmp) ¼Ð»xºô¸ôºÏºÐ¾÷

Vsible=False

Floppy(Image) Picture(Floppy.bmp) ¼Ð»x³nÅX

Visible=False

Fixed(Image) Picture(Fixed.bmp) ¼Ð»xµwÅX

Visible=False

¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w

¡@

¤lµøµ¡¥D¿ï¾Üªí¥]¬AFile¡BFunction¡BDirectory¤T­Ó¿ï¾Üªí¶µ¡A ¤À§O¥Î©ó§¹¦¨¤å¥óªº°ò¥»ºÞ²z¥\¯à¡B¨ä¥¦ºÞ²z¥\¯à©M¥Ø¿ýºÞ²z¥\¯à¡C

¡@¡@¥Ñ©ó¹ï¸Ü¤è¶ô¤¶­±³]­p«Ü²³æ¡A³oùؤ£¦A¶i¦æÂØ­z¡C ŪªÌ¥iª½±µ°Ñ¦Ò«á­±±Nµ¹¥Xªº¹ï¸Ü¤è¶ô¤¶­±¹Ï(¹Ï6.8---6.13)¶i¦æ³]­p¡C

¡@

6.4.2 ¤lµøµ¡ªº«Ø¥ß¡B¥¬¸m©MÃö³¬

¡@

¡@¡@¤lµøµ¡ªº«Ø¥ß¡B¥¬¸m¥Ñ¤÷µøµ¡ªºWindows¿ï¾Üªí±±¨î¡A¨ä¿ï¾Üªí¶µ¦p¤U¡G

¡@¡@¡´ New Windows : «Ø¥ß·sªº¤lµøµ¡

¡´ Tile : «D­«Å|Åã¥Ü

¡@¡@¡´ Cascade : ­«Å|Åã¥Ü

¡@¡@¡´ ArrangeIcon : ¦w±Æ¹Ï¥Ü

¡@ ¡´ Minimized All : ·¥¤p¤Æ©Ò¦³¤lµøµ¡

¡@

¡@¡@¤lµøµ¡ªº«Ø¥ß¥u»Ý­n²³æ©I¥sµ¡Å骺Create¤èªk¡G

¡@

¡@¡@FileMan := TFMForm.Create(Application);

¡@

¤lµøµ¡ªº¼Ð·Ç±Æ¦C¤è¦¡ª½±µ©I¥sMDIµøµ¡ªº¼Ð·Ç¤èªkTile¡BCascade©MArrangeIcons¡C

¡@¡@·¥¤p¤Æ©Ò¦³¤lµøµ¡ªº¹ê²{§Q¥ÎMDIµøµ¡ªº¨â­ÓÄÝ©Ê¡GMDIChildCount©MMDIChildren¡G

¡@

¡@¡@for i := 0 to MDICount - 1 do

MDIChildren[i].Windowstate := wsMinimized;

¡@

¡@

¡@¡@¤lµøµ¡Ãö³¬®ÉÄÀ©ñ°O¾ÐÅéªÅ¶¡¡A¬°¦¹¦b¤lµøµ¡TFMFormªºOnClose¨Æ¥ó¤¤¥O

¡@

Action := OnFree¡F

¡@

¡@¡@¬°¤F«O«ù©MWindowsªºFile Managerªº¤@­P©Ê¡A§Ú­Ì¤]¸T¤îÃö³¬³Ì«á¤@­Ó¤lµøµ¡¡A³o»Ý­n¦b¤lµøµ¡ªºOnCloseQuery¨Æ¥ó³B²z¹Lµ{¤¤¹ê²{¡G

¡@

If FileManager.MDIChildCount <= 1 then

CanClose := False;

¡@

CanClose¬OOnCloseQuery¨Æ¥ó¹Lµ{ªð¦^ªº¤@­Ó°Ñ¼Æ¡A¥Î©ó§P©wµøµ¡¬O§_¥i¥HÃö³¬¡C

¡@¡@¥Ñ©ó³o¤@¹Lµ{Âk¤lµøµ¡©Ò¦³¡A¦]¦ÓMDIChildCount«e¥²¶·¥[¤W¨äª«¥ó¦WFileManager¡C

¡@¡@¦ý¤£©¯ªº¬O¡G³o¼Ë¤@¨Ó§Ú­Ìªºµ{¦¡µLªk²×¤î¤F¡I­ì¨ÓMDIµøµ¡Ãö³¬«e­º¥ýÃö³¬¨ä©Ò¦³ªº¤lµøµ¡¡C¦pªG¤lµøµ¡¤£¯àÃö³¬¡AMDIµøµ¡¤]¤£¯àÃö³¬¡C

¬°¦¹§Ú­Ì»Ý­n§PÂ_µo¥XÃö³¬°T®§ªº¬O¤lµøµ¡ªº¨t²Î¿ï¾ÜªíÁÙ¬O¿ï¾ÜªíªºExit¶µ¡C

¡@¡@©w¸q¤@­Ó¥þ§½ÅܼÆ

¡@

¡@¡@var

ExitClick: Boolean;

¡@

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

¡@

ExitClick := True;

FileManager.Exit1Click(Sender);

¡@

¡@

¡@¡@¤lµøµ¡Ãö³¬«e¥i¥H§Q¥Î³o¤@¥þ§½Åܼư»´ú¬O§_À³Ãö³¬¡G

¡@

¡@¡@If (FileManager.MDIChildCount <= 1) and (Not ExitClick) then

CanClose := False;

¡@

6.4.3 ¤å¥ó±±¥óªºÁpô

¡@

¡@¡@¦b¥»¨Ò¤¤§Ú­Ì¨Ï¥Î¤F¤@¸s¸s²Õ·sªº±±¥ó¡GTabSet¡BDirectoryOutline¡BFileListBox¡A¥Î©óÅã¥Ü©M¿ï¾ÜºÏºÐ¾÷¡B¥Ø¿ý©M¤å¥ó¡C»P(6.3)¤¤©Ò¥Î¤èªk¬Û¤ñ¡A¨Ï¥Î³o¤@¸s¸s²Õ±±¥ó»Ý­n¤Ö¶qªº¥N½X¤ä´©¡C

¡@¡@TabSet»PDirectoryOutlineªºÁpô¦bTabSetªºClick¨Æ¥ó³B²z¹Lµ{¤¤«Ø¥ß¡G

¡@

¡@¡@With DriveTabSet do

DirectoryOutline.Drive := Tabs[TabIndex][1];

¡@

DirectoryOutline»PFileListBoxªºÁpô¦bDirectoryOutlineªºChange¨Æ¥ó³B²z¹Lµ{¤¤«Ø¥ß¡G

¡@

FileList.Directory := DirectoryOutline.Directory;

FileList.Update;

¡@

6.4.4 DriveTabSetªº¦Ûµe­·®æÅã¥Ü¡@

¡@¡@Dephi¬°¤@¨Ç±±¥ó´£¨Ñ¤F¦Ûµe­·®æªºÅã¥Ü¡A¦pListBox¡BComboBox¡BTabSetµ¥¡C ¦b¯Ê¬Ù±¡ªp¤U¡A³o¨Ç±±¥ó¦Û°ÊÅã¥Ü¤å¥»¡C¦Ó¦b¦Ûµe­·®æ¤U¡A¾Ö¦³±±¥óªºµ¡Åé¦b°õ¦æ®É¶¡¤º¦Û¤vµe¥X±±¥óªº¨C¤@¶µ¥Ø¡C

¦Ûµe­·®æÅã¥Ü³q±`ªºÀ³¥Î¬O¬°¶µ¥Ø°£¤å¥»¥~¦A¥[¤J¹Ï§ÎÅã¥Ü¡C¯à¥H¦Ûµe­·®æÅã¥Üªº±±¥ó¦³¤@­Ó¦@¦P¯SÂI¡G³£¾Ö¦³¤@­ÓTStrings«¬¦¡ªº¶µ¥ØÁå¡C¥Ñ©óTStringsÃþªº¯SÂI(°Ñ²Ä¤T³¹)¡A¥¦­Ì³£¥i¥H¥[¤J¤@­Ó©M¹ïÀ³¤å¥»¬ÛÁpôªºª«¥ó¡C ¦Ó³o¥¿¬O¦Ûµe­·®æÅã¥ÜªºÃöÁä¡C

¡@¡@³q±`±¡ªp¤U²£¥Í¤@­Ó¦Ûµe­·®æ»Ý­n¤T­Ó¨BÆJ¡G

¡@¡@1.³]©w¦Ûµe­·®æ¡F

¡@¡@2.¦V¦r¤¸¦êÁåªí¥[¤J¹Ï§Îª«¥ó¡F

¡@¡@3.µe¥X¦Ûµe¶µ¥Ø¡C¡@

6.4.4.1 ³]©w¦Ûµe­·®æ¡@

¡@¡@±±¥óÄÝ©ÊStyle ¥Î©ó³]©w¦Ûµe­·®æ¡C¹ï©óDriveTabSet¡A§Ú­Ì§âStyle Äݩʳ]©w¬°tsOwnerDraw¡C

¡@¡@¹ï©óListBox¡BComboBoxµ¥±±¥óªº³]©w»PTabSet²¤¦³®t²§¡AŪªÌ¥i°Ñ¾\³s½u»²§U±Ô­z¤åÀÉ¡C¡@

6.4.4.2 ¦V¦r¤¸¦êÁåªí¥[¤J¹Ï§Îª«¥ó¡@

¡@¡@1.¦bÀ³¥Îµ{¦¡¤¤¥[¤J¹Ï¤ù³¡¥ó

¡@¡@¦b¥»µ{¦¡¤¤§Ú­Ì³]©w¤F¤T­Ó¹Ï¤ù³¡¥óNetWork¡BFloppy¡BFixed¡A¨Ã¤À§O»P¤T­ÓÂI°}¹Ï¤å¥óNetWork.bmp¡BFloppy.bmp¡BFixed.bmp¬ÛÃöÁp¡C

¡@¡@2.§â¹Ï¤ù¥[¤J¨ì¦r¤¸¦êÁåªí¤¤

¡@¡@®Ú¾Ú¦r¤¸¦êÁåªíªº©Ê½è¡A§Ú­Ì¥i¥H§âª«¥ó»P¤w¦s¦bªº¦r¤¸¦ê«Ø¥ßÁpô¡A¤]¥i¥H¦P®É¥[¤J¦r¤¸¦ê©Mª«¥ó¡C³oùاڭ̱ĥΫá¤@ºØ¤èªk¡C

¡@¡@¦b¤lµøµ¡ªºOnCreate¨Æ¥ó³B²z¹Lµ{¤¤¡A§Ú­Ì§Q¥Î¤@­Ó¦^°é¨Ì¦¸°»´ú±qa¨ìzªººÏºÐ¾÷¬O§_¦s¦b¥H¤ÎºÏºÐ¾÷ªº«¬¦¡¡C³o§Q¥Î¤FWindwos API¨ç¼ÆGetDrivetype, ¦pªGºÏºÐ¾÷¤£¦s¦b«hªð¦^0¡A§_«hªð¦^ºÏºÐ¾÷ªº«¬¦¡(DRIVE_REMOVABLE¡BDRIVE_FIXED¡BDRIVE_REMOTE)¡C®Ú¾ÚºÏºÐ¾÷«¬¦¡§Ú­Ì¥i¥H§PÂ_»P¤å¥»(ºÏºÐ¾÷¦W)¦P®É¥[¤J¨ìTabs¤¤ªº¤£¦P¹Ï§Îª«¥ó¡C¦b¥[¤J¹Lµ{¤¤¡ADriveTabSetªºTabIndex³Q³]©w¬°¥Ø«eºÏºÐ¾÷¡C

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

procedure TFMForm.FormCreate(Sender: TObject);

var

Drive, AddedIndex: Integer;

DriveLetter: Char;

begin

for Drive := 0 to 25 do

begin

DriveLetter := Chr(Drive + ord('a'));

case GetDrivetype(Drive) of

DRIVE_REMOVABLE:

AddedIndex := DriveTabSet.Tabs.AddObject(DriveLetter, Floppy.Picture.Graphic);

DRIVE_FIXED:

AddedIndex := DriveTabSet.Tabs.AddObject(DriveLetter, Fixed.Picture.Graphic);

DRIVE_REMOTE:

AddedIndex := DriveTabSet.Tabs.AddObject(DriveLetter, Network.Picture.Graphic);

end;

if UpCase(DriveLetter) = UpCase(FileList.Drive) then

DriveTabSet.TAbIndex := AddedIndex;

end;

end;

6.4.4.3 µe¥X¦Ûµe¶µ¥Ø¡@

¡@¡@·í§â¤@­Ó±±¥óªº­·®æ³]©w¬°¦Ûµe®É¡AWindows¤£¦A­t³d©¹¿Ã¹õ¤Wµe¥X±±¥óªº¶µ¥Ø¡A¦Ó¬O¬°¨C­Ó¥i¨£¶µ¥Ø²£¥Í¦Ûµe¨Æ¥ó¡CÀ³¥Îµ{¦¡¥i¥H³q¹L³B²z¦Ûµe¨Æ¥óµe¥X±±¥óªº¶µ¥Ø¡C¡@

1.½T©w¦Ûµe¶µ¥Øªº¤j¤p¡@

¡@¡@¹ï©óTabSet¦Ó¨¥¡A³o¦bOnMeasureTab¨Æ¥ó³B²z¹Lµ{¤¤§¹¦¨¡C§Ú­Ì»Ý­n§âDriveTabSet¨C­Ó¼ÐÅÒªº¼e«×¼W¤j¨ì¨¬¥H¦P®É©ñ¤U¤å¥»©MÂI°}¹Ï¡C¡@

procedure TFMForm.DriveTabSetMeasureTab(Sender: TObject; Index: Integer;

var TabWidth: Integer);

var

BitmapWidth: Integer;

begin

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

Inc(TabWidth, 2 + BitmapWidth);

end;

¡@¡@¥Ñ©óTStringsªºObjectsÄݩʤ¤¦s©ñªºª«¥ó³£¬OTObject«¬¦¡¡A¨Ã¨S¦³WidthÄÝ©Ê¡A¦]¦Ó»Ý­n¦A§â¥¦Âà¤Æ¬°TBitmap«¬¦¡ªºª«¥ó¡G¡@

¡@ BitmapWidth := TBitmap(DriveTabSet.Tabs.Objects[Index]).Width;

¡@


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