Ejemplo n.º 1
0
BOOL CGridBtnCellBase::GetTextRect( LPRECT pRect)  // i/o:  i=dims of cell rect; o=dims of text rect
{
    CGridCtrl* pGrid = GetGrid();
    ASSERT( pGrid);

    CRect RectCell( *pRect);

    // any button images
    ASSERT( MAX_NBR_CTLS_INCELL > GetDrawCtlNbrMax() ); // whoa!
    CRect RectAry[ MAX_NBR_CTLS_INCELL];

    const int iCtlNbr = GetDrawCtlNbr();
    if( iCtlNbr > 0)
    {
        if( CalcDrawCtlRects(   RectAry,    // returns:  CRects with coordinates
                                            //  last entry has optional leftover rect
                                            //  available for text, etc.
                                MAX_NBR_CTLS_INCELL,// nbr of Rects in above array
                                *pRect) )   // cell rectangle to work with
        {
            // allowable text area has shrunk up
            *pRect = RectAry[ iCtlNbr];
            pRect->left += GetMargin();
            pRect->right -= GetMargin();
        }

    }


    // I've modified the starting point before passing to base
    return CGridCellBase::GetTextRect( pRect);
}
BOOL CGridTreeCellBase::Draw(CDC* pDC, int nRow, int nCol, CRect rect,
    BOOL bEraseBkgnd /*=TRUE*/)
{
    CRect RectCell( rect);
    if( DrawTreeCell( pDC, nRow, nCol, &RectCell, bEraseBkgnd) )
    {
        // call base class to finish it off
        return CGridCellBase::Draw( pDC, nRow, nCol, RectCell, bEraseBkgnd);
    }
    return FALSE;
}