Good day! How to get the index of the line when the cursor is on a line without datagridview_mouseenter? Or how to enable datagridview_mouseenter only if datagridview_cellmousedown is enabled?

Purpose: Using dragDrop, it is necessary during dragging, at the moment when the left mouse button is clamped and holds selected records from another data grid, to get the index of the first data grid line over which the cursor is now located.

    1 answer 1

    Found how to solve, maybe a crutch.

    Point dscreen = new Point(eX, eY); Point dclient = gridShift.PointToClient(dscreen); DataGridView.HitTestInfo hitTest = gridShift.HitTest(dclient.X, dclient.Y); 
    • Why, it is not a crutch. PointToClient correctly applied. - Alexander Petrov