ListView Control Can't Drag and Drop in Virtual Mode

234 Views Asked by At

I have searched and I cannot find an answer to my question. I have a ListView that is moving to VirtualMode, but when I attempt a drag over operation, it fails. It can't find the correct insertion index because the items are virtual. How do you do a proper drag over of a ListView Item when in virtual mode?

Basically the problem is that NearestIndex is returning -1 no matter where the mouse is. This code worked prior to moving to virual mode.

int theTargetIdx = InsertionMark->NearestIndex( thePoint );

if ( theTargetIdx > -1 )
{
    System::Drawing::Rectangle theItemBounds = GetItemRect( theTargetIdx );
    if ( thePoint.Y > theItemBounds.Top + (theItemBounds.Height / 2) )
    {
        InsertionMark->AppearsAfterItem = true;
    }
    else
    {
        InsertionMark->AppearsAfterItem = false;
    }
}
else
{
    aArgs->Effect = System::Windows::Forms::DragDropEffects::None;  
}

InsertionMark->Index = theTargetIdx;
0

There are 0 best solutions below