zoukankan      html  css  js  c++  java
  • 多列分页算法

     

    private void ShowRecord(int RecordCount,int CellCount,int CurrentPage)
    {
                
    int CurrentRC,TotalCount,FinalCount,CurrentLocation;
                
    string ImageName,ImageUrl;
                TableRow Tr
    =new TableRow();
                TableCell Tc
    =new TableCell();
                TotalCount
    =RecordInfo.GetRecordCount();

                FinalCount
    =TotalCount/CellCount+1;
                TotalPage
    =(FinalCount-1)/RecordCount+1;
                CurrentRC
    =FinalCount-(CurrentPage-1)*RecordCount;
                
    if(CurrentRC>RecordCount) CurrentRC=RecordCount;
                
    if(CurrentPage>TotalPage) CurrentPage=1;
                
    for(int i=(CurrentPage-1)*RecordCount;i<CurrentRC+(CurrentPage-1)*RecordCount;i++)
                
    {
                    Tc.Controls.Add(
    new LiteralControl("<table><tr>"));
                    
    for(int j=1;j<=CellCount;j++)
                    
    {
                        CurrentLocation
    =(CurrentPage-1)*RecordCount*CellCount+(i%RecordCount)*CellCount+j;
                        
    if(TotalCount>=CurrentLocation)
                        
    {
                            ImageName
    =RecordInfo.GetValue(CurrentLocation-1,1);
                            ImageUrl
    =RecordInfo.GetValue(CurrentLocation-1,0);
                            Tc.Controls.Add(
    new LiteralControl("<td width='120' height='120'><a target='_blank' title='"+ImageName+"' href='"+ImageUrl+"'><img border='0' width='100' height='100' src='"+ImageUrl+"'></a></td>"));
                        }

                        
    else 
                            j
    =CellCount+1;
                    }

                    
                    Tc.Controls.Add(
    new LiteralControl("</tr></table>"));
                    Tr.Cells.Add(Tc);
                    pic.Rows.Add(Tr);
                }

    }
  • 相关阅读:
    Matplotlib
    Numpy&Pandas
    莫凡《机器学习》笔记
    李宏毅《1天搞懂深度学习》笔记
    Git客户端使用教程
    像素级压缩感知图像融合的论文
    二分图【洛谷P2175】 小Z的游戏分队
    模板【洛谷P3390】 【模板】矩阵快速幂
    模板 可并堆【洛谷P3377】 【模板】左偏树(可并堆)
    LCA SP913 QTREE2
  • 原文地址:https://www.cnblogs.com/Random/p/523450.html
Copyright © 2011-2022 走看看