HexEdit/GridCtrl_src/GridCtrl.cpp
DROPEFFECT CGridCtrl::OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState,
                                  CPoint point)
{
    // Any text data available for us?
    if (!m_bAllowDragAndDrop || !pDataObject->IsDataAvailable(CF_TEXT))
        return DROPEFFECT_NONE;

    // Find which cell we are over and drop-highlight it
    m_LastDragOverCell = GetCellFromPt(point, FALSE);
    if (!IsValid(m_LastDragOverCell))
        return DROPEFFECT_NONE;

    if (!IsCellEditable(m_LastDragOverCell))
        return DROPEFFECT_NONE;

    if (IsValid(m_LastDragOverCell))
    {
        UINT nState = GetItemState(m_LastDragOverCell.row, m_LastDragOverCell.col);
        SetItemState(m_LastDragOverCell.row, m_LastDragOverCell.col,
            nState | GVIS_DROPHILITED);
        RedrawCell(m_LastDragOverCell);
    }

    // Return an appropraite value of DROPEFFECT so mouse cursor is set properly
    if (dwKeyState & MK_CONTROL)
        return DROPEFFECT_COPY;
    else
        return DROPEFFECT_MOVE;
}
// Something has just been dragged onto the grid

Something has just been dragged onto the grid
Something has just been dragged onto the grid
DROPEFFECT CGridCtrl::OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState,
                                  CPoint point)
{
    if (!m_bAllowDragAndDrop || !pDataObject->IsDataAvailable(CF_TEXT))
        return DROPEFFECT_NONE;
    m_LastDragOverCell = GetCellFromPt(point, FALSE);
    if (!IsValid(m_LastDragOverCell))
        return DROPEFFECT_NONE;
    if (!IsCellEditable(m_LastDragOverCell))
        return DROPEFFECT_NONE;
    if (IsValid(m_LastDragOverCell))
    {
        UINT nState = GetItemState(m_LastDragOverCell.row, m_LastDragOverCell.col);
        SetItemState(m_LastDragOverCell.row, m_LastDragOverCell.col,
            nState | GVIS_DROPHILITED);
        RedrawCell(m_LastDragOverCell);
    }
    if (dwKeyState & MK_CONTROL)
        return DROPEFFECT_COPY;
    else
        return DROPEFFECT_MOVE;
}
DROPEFFECT CGridCtrl :: OnDragEnter ( COleDataObject * pDataObject , DWORD dwKeyState , CPoint point ) { if ( ! m_bAllowDragAndDrop || ! pDataObject -> IsDataAvailable ( CF_TEXT ) ) return DROPEFFECT_NONE ; m_LastDragOverCell = GetCellFromPt ( point , FALSE ) ; if ( ! IsValid ( m_LastDragOverCell ) ) return DROPEFFECT_NONE ; if ( ! IsCellEditable ( m_LastDragOverCell ) ) return DROPEFFECT_NONE ; if ( IsValid ( m_LastDragOverCell ) ) { UINT nState = GetItemState ( m_LastDragOverCell . row , m_LastDragOverCell . col ) ; SetItemState ( m_LastDragOverCell . row , m_LastDragOverCell . col , nState | GVIS_DROPHILITED ) ; RedrawCell ( m_LastDragOverCell ) ; } if ( dwKeyState & MK_CONTROL ) return DROPEFFECT_COPY ; else return DROPEFFECT_MOVE ; }
Something has just been dragged onto the grid
Something has just been dragged onto the grid
// Any text data available for us?
 // Find which cell we are over and drop-highlight it
 // Return an appropraite value of DROPEFFECT so mouse cursor is set properly
