HexEdit/NewCellTypes/GridCellCombo.cpp
BOOL CGridCellCombo::Draw(CDC* pDC, int nRow, int nCol, CRect rect,  BOOL bEraseBkgnd /*=TRUE*/)
{
#ifdef _WIN32_WCE
    return CGridCell::Draw(pDC, nRow, nCol, rect,  bEraseBkgnd);
#else
    // Cell selected?
    //if ( !IsFixed() && IsFocused())
    if (GetGrid()->IsCellEditable(nRow, nCol) && !IsEditing())
    {
        // Get the size of the scroll box
//        CSize sizeScroll(GetSystemMetrics(SM_CXVSCROLL), GetSystemMetrics(SM_CYHSCROLL));
        CSize sizeScroll(rect.Height()-1, rect.Height()+1);

        // enough room to draw?
//        if (sizeScroll.cy < rect.Width() && sizeScroll.cy < rect.Height())
        if (sizeScroll.cy < rect.Width())
        {
            // Draw control at RHS of cell
            CRect ScrollRect = rect;
            ScrollRect.left   = rect.right - sizeScroll.cx;
            ScrollRect.bottom = rect.top + sizeScroll.cy;

            // Do the draw
            pDC->DrawFrameControl(ScrollRect, DFC_SCROLL, DFCS_SCROLLDOWN);

            // Adjust the remaining space in the cell
            rect.right = ScrollRect.left;
        }
    }

    CString strTempText = (CString)GetText();
    if (IsEditing())
        SetText(_T(""));

    // drop through and complete the cell drawing using the base class' method
    BOOL bResult = CGridCell::Draw(pDC, nRow, nCol, rect,  bEraseBkgnd);

    if (IsEditing())
        SetText(strTempText);

	return bResult;
#endif
}
// Override draw so that when the cell is selected, a drop arrow is shown in the RHS.

Override draw so that when the cell is selected, a drop arrow is shown in the RHS.
Override draw so that when the cell is selected a drop arrow is shown in the RHS .
BOOL CGridCellCombo::Draw(CDC* pDC, int nRow, int nCol, CRect rect,  BOOL bEraseBkgnd )
{
#ifdef _WIN32_WCE
    return CGridCell::Draw(pDC, nRow, nCol, rect,  bEraseBkgnd);
#else
    if (GetGrid()->IsCellEditable(nRow, nCol) && !IsEditing())
    {
        CSize sizeScroll(rect.Height()-1, rect.Height()+1);
        if (sizeScroll.cy < rect.Width())
        {
            CRect ScrollRect = rect;
            ScrollRect.left   = rect.right - sizeScroll.cx;
            ScrollRect.bottom = rect.top + sizeScroll.cy;
            pDC->DrawFrameControl(ScrollRect, DFC_SCROLL, DFCS_SCROLLDOWN);
            rect.right = ScrollRect.left;
        }
    }
    CString strTempText = (CString)GetText();
    if (IsEditing())
        SetText(_T(""));
    BOOL bResult = CGridCell::Draw(pDC, nRow, nCol, rect,  bEraseBkgnd);
    if (IsEditing())
        SetText(strTempText);
	return bResult;
#endif
}
BOOL CGridCellCombo :: Draw ( CDC * pDC , int nRow , int nCol , CRect rect , BOOL bEraseBkgnd ) { #ifdef _WIN32_WCE return CGridCell :: Draw ( pDC , nRow , nCol , rect , bEraseBkgnd ) ; #else if ( GetGrid ( ) -> IsCellEditable ( nRow , nCol ) && ! IsEditing ( ) ) { CSize sizeScroll ( rect . Height ( ) - 1 , rect . Height ( ) + 1 ) ; if ( sizeScroll . cy < rect . Width ( ) ) { CRect ScrollRect = rect ; ScrollRect . left = rect . right - sizeScroll . cx ; ScrollRect . bottom = rect . top + sizeScroll . cy ; pDC -> DrawFrameControl ( ScrollRect , DFC_SCROLL , DFCS_SCROLLDOWN ) ; rect . right = ScrollRect . left ; } } CString strTempText = ( CString ) GetText ( ) ; if ( IsEditing ( ) ) SetText ( _T ( " " ) ) ; BOOL bResult = CGridCell :: Draw ( pDC , nRow , nCol , rect , bEraseBkgnd ) ; if ( IsEditing ( ) ) SetText ( strTempText ) ; return bResult ; #endif }
Override draw so that when the cell is selected, a drop arrow is shown in the RHS.
Override draw so that when the cell is selected a drop arrow is shown in the RHS .
/*=TRUE*/ // Cell selected?
 //if ( !IsFixed() && IsFocused())
 // Get the size of the scroll box
 //        CSize sizeScroll(GetSystemMetrics(SM_CXVSCROLL), GetSystemMetrics(SM_CYHSCROLL));
 // enough room to draw?
 //        if (sizeScroll.cy < rect.Width() && sizeScroll.cy < rect.Height())
 // Draw control at RHS of cell
 // Do the draw
 // Adjust the remaining space in the cell
 // drop through and complete the cell drawing using the base class' method
