
16.06.2011, 12:07
|
Начинающий
|
|
Регистрация: 04.02.2011
Адрес: Москва
Сообщения: 148
Версия Delphi: 7
Репутация: 133
|
|
Код:
procedure TForm1.Button1Click(Sender: TObject);
var
sr: TSearchRec;
i:integer;
sDir:array of array [0..1] of Cardinal;
begin
RichEdit1.Clear;
if (FindFirst(ExtractFilePath(ParamStr(0))+'\*.*', faAnyFile, sr) = 0) then
begin
repeat
RichEdit1.Text:=RichEdit1.Text+sr.Name+' ';
if sr.Attr and faDirectory <> 0 then //если папка то делаем её жирной
begin
SetLength(sDir,Length(sDir)+1);
sDir[Length(sDir)-1,0]:=length(sr.Name);
sDir[Length(sDir)-1,1]:=length(RichEdit1.Text)-length(sr.Name)-1;
end;
until FindNext(sr) <> 0;
for i:=0 to Length(sDir)-1 do
begin
RichEdit1.SelStart:=sDir[i,1];
RichEdit1.SelLength:=sDir[i,0];
RichEdit1.SelAttributes.Style := [fsBold];
end;
FindClose(sr);
sDir:=nil;
end;
end;
|