diff --git a/ShareX.HistoryLib/HistoryForm.Designer.cs b/ShareX.HistoryLib/HistoryForm.Designer.cs index c6d4499c2..df12ab2f6 100644 --- a/ShareX.HistoryLib/HistoryForm.Designer.cs +++ b/ShareX.HistoryLib/HistoryForm.Designer.cs @@ -99,6 +99,7 @@ private void InitializeComponent() this.lvHistory.Name = "lvHistory"; this.lvHistory.UseCompatibleStateImageBehavior = false; this.lvHistory.View = System.Windows.Forms.View.Details; + this.lvHistory.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.lvHistory_ItemDrag); this.lvHistory.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lvHistory_ItemSelectionChanged); this.lvHistory.KeyDown += new System.Windows.Forms.KeyEventHandler(this.lvHistory_KeyDown); this.lvHistory.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lvHistory_MouseDoubleClick); diff --git a/ShareX.HistoryLib/HistoryForm.cs b/ShareX.HistoryLib/HistoryForm.cs index aac20b3e9..a6b7ee940 100644 --- a/ShareX.HistoryLib/HistoryForm.cs +++ b/ShareX.HistoryLib/HistoryForm.cs @@ -27,6 +27,7 @@ using ShareX.HistoryLib.Properties; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Windows.Forms; @@ -395,6 +396,24 @@ private void lvHistory_KeyDown(object sender, KeyEventArgs e) e.Handled = true; } + private void lvHistory_ItemDrag(object sender, ItemDragEventArgs e) + { + List selection = new List(); + + foreach (ListViewItem item in lvHistory.SelectedItems) + { + HistoryItem hi = (HistoryItem)item.Tag; + if (File.Exists(hi.Filepath)) + selection.Add(hi.Filepath); + } + + if (selection.Count == 0) + return; + + DataObject data = new DataObject(DataFormats.FileDrop, selection.ToArray()); + DoDragDrop(data, DragDropEffects.Copy); + } + private void txtFilenameFilter_TextChanged(object sender, EventArgs e) { cbFilenameFilter.Checked = txtFilenameFilter.TextLength > 0;