请输入关键字
C#分页显示目录下文件列表
Alin|2017-5-12
System.IO.FileInfo[] arrFile=DI.GetFiles();
通过这行代码你都已经获取到了目录下的所有文件了,要实现分页不就简单了嘛
int filecount = 0, countperpage = 10;
if(arrFile != null && arrFile.Length > 0)
{
    filecount = arrFile.Length;
    int pages = (filecount + countperpage -1)   % countperpage;
    for(int i = 1;i<=pages; i++)
    {
        FileInfo[] pageFiles = new FileInfo[countperpage];
        for(int j = (i - 1) * countperpage; j<i*countperpage;j++)
       {
            pageFiles[ j % countperpage] = arrFile[j];
      }
   }
}
赞一下23||已浏览1789

本站版本归木之林解释所有 copyright(C)2010-2025www.mzlin.net 备案/许可证编号为:粤ICP备15050036号