mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-06 05:05:42 +13:00
Merge pull request #2867 from campbeb/issue1550v2
Add drag and drop from history window
This commit is contained in:
commit
b3640f6f88
2 changed files with 20 additions and 0 deletions
1
ShareX.HistoryLib/HistoryForm.Designer.cs
generated
1
ShareX.HistoryLib/HistoryForm.Designer.cs
generated
|
@ -99,6 +99,7 @@ private void InitializeComponent()
|
||||||
this.lvHistory.Name = "lvHistory";
|
this.lvHistory.Name = "lvHistory";
|
||||||
this.lvHistory.UseCompatibleStateImageBehavior = false;
|
this.lvHistory.UseCompatibleStateImageBehavior = false;
|
||||||
this.lvHistory.View = System.Windows.Forms.View.Details;
|
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.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lvHistory_ItemSelectionChanged);
|
||||||
this.lvHistory.KeyDown += new System.Windows.Forms.KeyEventHandler(this.lvHistory_KeyDown);
|
this.lvHistory.KeyDown += new System.Windows.Forms.KeyEventHandler(this.lvHistory_KeyDown);
|
||||||
this.lvHistory.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lvHistory_MouseDoubleClick);
|
this.lvHistory.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lvHistory_MouseDoubleClick);
|
||||||
|
|
|
@ -27,6 +27,7 @@ You should have received a copy of the GNU General Public License
|
||||||
using ShareX.HistoryLib.Properties;
|
using ShareX.HistoryLib.Properties;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
@ -395,6 +396,24 @@ private void lvHistory_KeyDown(object sender, KeyEventArgs e)
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void lvHistory_ItemDrag(object sender, ItemDragEventArgs e)
|
||||||
|
{
|
||||||
|
List<string> selection = new List<string>();
|
||||||
|
|
||||||
|
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)
|
private void txtFilenameFilter_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
cbFilenameFilter.Checked = txtFilenameFilter.TextLength > 0;
|
cbFilenameFilter.Checked = txtFilenameFilter.TextLength > 0;
|
||||||
|
|
Loading…
Reference in a new issue