如何控制stringgrid实现分页显示?或者像dbgrid那样显示数据?

解决方案 »

  1.   

    int nRow, nCol;
    int iCount=0;
        m_strQuery = "select * from ClientMeterInfo_tab order by CIID";
        IBQuery1->Close();
        IBQuery1->SQL->Clear();
        IBQuery1->SQL->Add(m_strQuery);
        IBQuery1->Open();
        CustomerHeadInfo();//显示客户信息列表头
        LoadMeterInfo();   //加载电表与终端编号
        IBQuery1->First();
        grdCustomInfo->RowCount = 2;
        nRow =1 ;
        while (!IBQuery1->Eof && iCount<=100)
        {
            for (nCol= 0 ; nCol < IBQuery1->FieldCount ; nCol++)
            {
              grdCustomInfo->Cells[nCol][nRow] = IBQuery1->Fields->Fields[nCol]->AsString;
            }
            IBQuery1->Next();
            iCount++;
            grdCustomInfo->RowCount++;
            nRow++;
        }    grdCustomInfo->RowCount--;