http://codeguru.earthweb.com/cgi-bin/bbs/wt/showpost.pl?Board=vb&Number=70426&page=18&view=collapsed&sb=5
Print Using MSFlexGrid, it is in VB. Hope you can translate it into VC.

解决方案 »

  1.   

    这是从我的程序中考出来的: for(nrow=0;nrow<m_grid.GetRows();nrow++)
    {
    m_grid.SetRow(nrow);
    for(ncol=0;ncol<m_grid.GetCols();ncol++)
    {
    m_grid.SetCol(ncol);
    textRect.left=rect.left+m_grid.GetCellLeft()/15*9;
    textRect.top=rect.top+m_grid.GetCellTop()/15*9;
    textRect.right=textRect.left+m_grid.GetCellWidth()/15*9;
    textRect.bottom =textRect.top+m_grid.GetCellHeight()/15*9;
    // pDC->Rectangle(textRect);
    UINT nFormat=DT_WORDBREAK |DT_VCENTER|DT_LEFT;//DT_CALCRECT|DT_WORDBREAK | DT_EXPANDTABS
    pDC->DrawText(m_grid.GetTextMatrix(nrow,ncol),textRect,nFormat);
    // pDC->Draw3dRect(textRect,0,0);
    }
    iy=iy+m_grid.GetRowHeight(nrow)/15*9;
    pDC->MoveTo(rect.left,iy);
    pDC->LineTo(rect.right,iy);
    }
    for(ncol=0;ncol<m_grid.GetCols();ncol++)
    {
    ix=ix+m_grid.GetColWidth(ncol)/15*9;
    pDC->MoveTo(ix,rect.top);
    pDC->LineTo(ix,rect.bottom); }