在Listview里面,自己读取的某个文件夹下的目录,包括子文件和子目录,如何排序
读出内容如下:a表示文件夹 b 文件aaaa   a
bbbb   a
cccc   b
dddd   a
eeee   b
dddd   b如何把内容按文件夹、文件排序如下呢
aaaa   a
bbbb   a
dddd   a
eeee   b
dddd   b

解决方案 »

  1.   

    如何把内容按文件夹、文件排序如下呢
    aaaa   a
    bbbb   a
    dddd   a
    cccc   b
    eeee   b
    dddd   b应该是
      

  2.   

    简单的要命
    在listview 的compare事件 里写如下代码
    a为文件夹的图标索引
    如 if (item1.imageindex=a) and (item2.imageindex<>a) then
         compare:=-1
       else (item1.imageindex<>a) and (item2.imageindex=a) then
         compare:=1
       else 
         compare:=comparetext(ietm1.captiom,item2.caption);
    明白了吗?