void lv_files_MouseMove(object sender, MouseEventArgs e) { //Dragging an object in the list with LKM pressed if (e.Button == System.Windows.Forms.MouseButtons.Left && dragHelper.isSelected) { dragHelper.currentPositionPoint.X = e.X; dragHelper.currentPositionPoint.Y = e.Y; //If DRAG_DISTANCE pixels are dragged, we will enable dragging if (dragHelper.GetDistance() >= DRAG_DISTANCE) { ListViewItem currentLvi = lv_files.GetItemAt(e.X, e.Y); if (currentLvi == null) { return; } lv_files.DoDragDrop(currentLvi, DragDropEffects.Move); dragHelper.isDrag = true; } } }
void lv_files_MouseMove(object sender, MouseEventArgs e) { //Перетаскиваем объект в листвью списке с нажатой лкм if (e.Button == System.Windows.Forms.MouseButtons.Left && dragHelper.isSelected) { dragHelper.currentPositionPoint.X = e.X; dragHelper.currentPositionPoint.Y = e.Y; //Если протащили DRAG_DISTANCE пикселов - включим перетаскивание if (dragHelper.GetDistance() >= DRAG_DISTANCE) { ListViewItem currentLvi = lv_files.GetItemAt(e.X, e.Y); if (currentLvi == null) { return; } lv_files.DoDragDrop(currentLvi, DragDropEffects.Move); dragHelper.isDrag = true; } } }