Недавно добавленные исходники

•  Animation Loaders  699

•  DeLiKaTeS Tetris (Тетрис)  5 700

•  TDictionary Custom Sort  7 657

•  Fast Watermark Sources  7 348

•  3D Designer  10 555

•  Sik Screen Capture  7 874

•  Patch Maker  8 096

•  Айболит (remote control)  8 157

•  ListBox Drag & Drop  6 951

•  Доска для игры Реверси  100 172

•  Графические эффекты  8 220

•  Рисование по маске  7 613

•  Перетаскивание изображений  6 216

•  Canvas Drawing  6 583

•  Рисование Луны  6 509

•  Поворот изображения  5 684

•  Рисование стержней  4 606

•  Paint on Shape  3 302

•  Генератор кроссвордов  4 291

•  Головоломка Paletto  3 435

•  Теорема Монжа об окружностях  4 254

•  Пазл Numbrix  2 756

•  Заборы и коммивояжеры  3 660

•  Игра HIP  2 469

•  Игра Go (Го)  2 454

•  Симулятор лифта  2 861

•  Программа укладки плитки  2 297

•  Генератор лабиринта  3 021

•  Проверка числового ввода  2 523

•  HEX View  2 931

 
скрыть

  Форум  

Delphi FAQ - Часто задаваемые вопросы

| Базы данных | Графика и Игры | Интернет и Сети | Компоненты и Классы | Мультимедиа |
| ОС и Железо | Программа и Интерфейс | Рабочий стол | Синтаксис | Технологии | Файловая система |



Delphi Sources

Показываем директории в TTreeView




procedure TForm1.GetDirectories(Tree: TTreeView; Directory: string;
Item: TTreeNode; IncludeFiles: Boolean);
var 
  SearchRec: TSearchRec; 
  ItemTemp: TTreeNode; 
begin 
  Tree.Items.BeginUpdate; 
  if Directory[Length(Directory)] <> '\' then Directory := Directory + '\'; 
  if FindFirst(Directory + '*.*', faDirectory, SearchRec) = 0 then 
  begin 
    repeat 
      if (SearchRec.Attr and faDirectory = faDirectory) and
      (SearchRec.Name[1] <> '.') then 
      begin 
        if (SearchRec.Attr and faDirectory > 0) then 
          Item := Tree.Items.AddChild(Item, SearchRec.Name); 
        ItemTemp := Item.Parent; 
        GetDirectories(Tree, Directory + SearchRec.Name, Item, IncludeFiles); 
        Item := ItemTemp; 
      end 
      else if IncludeFiles then 
        if SearchRec.Name[1] <> '.' then 
          Tree.Items.AddChild(Item, SearchRec.Name); 
    until FindNext(SearchRec) <> 0; 
    FindClose(SearchRec); 
  end; 
  Tree.Items.EndUpdate; 
end; 

procedure TForm1.Button1Click(Sender: TObject); 
var 
  Node: TTreeNode; 
  Path: string; 
  Dir: string; 
begin 
  Dir := 'c:\temp'; 
  Screen.Cursor := crHourGlass; 
  TreeView1.Items.BeginUpdate; 
  try 
    TreeView1.Items.Clear; 
    GetDirectories(TreeView1, Dir, nil, True); 
  finally 
    Screen.Cursor := crDefault; 
    TreeView1.Items.EndUpdate; 
  end; 
end;








Copyright © 2004-2026 "Delphi Sources" by «SiteAnalyzer». Delphi World FAQ

Группа ВКонтакте