private void LView_OpenFileList_DragDrop(object sender, DragEventArgs e) { DebugManager.MessageOut("DragDrop"); var target_indices = (int[])e.Data.GetData(typeof(int[])); var target_files = new List <FileControlParam>(); foreach (var target_index in target_indices) { if (LView_OpenFileList.Items[target_index].Tag is FileControlParam file) { target_files.Add(file); } } var insert_index = GetOpenFileInsertIndex(LView_OpenFileList.PointToClient(new Point(e.X, e.Y))); files_.InsertRange(insert_index, target_files); foreach (var remove_index in target_indices.Reverse()) { if (remove_index > insert_index) { files_.RemoveAt(remove_index + target_files.Count); } } LView_OpenFileList.InsertionMark.Index = -1; }
private void LView_OpenFileList_DragOver(object sender, DragEventArgs e) { DebugManager.MessageOut("DragOver"); // e.Effect = DragDropEffects.Move; var insert_index = GetOpenFileInsertIndex(LView_OpenFileList.PointToClient(new Point(e.X, e.Y))); if (insert_index >= LView_OpenFileList.Items.Count) { LView_OpenFileList.InsertionMark.AppearsAfterItem = true; insert_index = Math.Max(insert_index - 1, 0); } else { LView_OpenFileList.InsertionMark.AppearsAfterItem = false; } LView_OpenFileList.InsertionMark.Index = insert_index; }