bonjour, je me suis servi de la démo de ftp client indy9 pour me créer un listing d'un serveur FTP, j'ai maintenant un listbox ordonnée en colonne comme image ci-dessous:



Je me sers de la procédure ci-dessous pour ordonner les lignes correctement sa vient de la démo:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Procedure TfmMain.lbDirectoryListBoxDrawItem(Control: TWinControl;
  Index: Integer; Rect: TRect; State: TOwnerDrawState);
Var
  R:                            TRect;
  SizeFile, TypeFile, DateFile: String;
Begin
  If odSelected In State Then
  Begin
    lbDirectoryListBox.Canvas.Brush.Color := $00895F0A;
    lbDirectoryListBox.Canvas.Font.Color  := clWhite;
  End
  Else
    lbDirectoryListBox.Canvas.Brush.Color := clWindow;
  If Assigned(IdFTP.DirectoryListing) And (IdFTP.DirectoryListing.Count > (Index + 1)) Then
  Begin
    lbDirectoryListBox.Canvas.FillRect(Rect);
    With IdFTP.DirectoryListing.Items[Index + 1] Do
    Begin
      If (FileName <> '..') and (FileName <> 'Dossier parent') Then
      Begin
        SizeFile := IntToStr(Size Div 1024) + ' KO';
        If ItemType = ditDirectory Then
          TypeFile := 'Dossier'
        Else
          TypeFile := 'Fichier';
        DateFile := FormatDateTime('dd/mm/yyyy hh:mm', ModifiedDate);
      End
      Else
      Begin
        FileName          := 'Dossier parent';
        SizeFile          := '';
        TypeFile          := '';
        DateFile          := '';
        PermissionDisplay := '';
      End;
      lbDirectoryListBox.Canvas.TextOut(Rect.Left, Rect.Top, FileName);
 
      R       := Rect;
      R.Left  := Rect.Left + HeaderControl1.Sections.Items[0].Width;
      R.Right := R.Left + HeaderControl1.Sections.Items[1].Width;
      lbDirectoryListBox.Canvas.FillRect(R);
      lbDirectoryListBox.Canvas.TextOut(R.Left, Rect.Top, SizeFile);
 
      R.Left  := R.Right;
      R.Right := R.Left + HeaderControl1.Sections.Items[2].Width;
      lbDirectoryListBox.Canvas.FillRect(R);
      lbDirectoryListBox.Canvas.TextOut(R.Left, Rect.Top, TypeFile);
 
      R.Left  := R.Right;
      R.Right := R.Left + HeaderControl1.Sections.Items[3].Width;
      lbDirectoryListBox.Canvas.FillRect(R);
      lbDirectoryListBox.Canvas.TextOut(R.Left, Rect.Top, DateFile);
 
      R.Left  := R.Right;
      R.Right := R.Left + HeaderControl1.Sections.Items[4].Width;
      lbDirectoryListBox.Canvas.FillRect(R);
      lbDirectoryListBox.Canvas.TextOut(R.Left, Rect.Top, PermissionDisplay);
    End;
  End;
End;
seulement voila je voudrai mettre des images a gauche des nom c'est a dire a la place de la colonne rouge, mais je ne sais pas comment m'y prendre.

sa ne serait pas mieux d'utiliser un stringgrid à la place d'un listbox?

merci pour votre aide

edit: j'ai trouvé sur le forum je chercherai mieux la prochaine fois