From 85b3923f631df1452012b3651943134773a990b5 Mon Sep 17 00:00:00 2001 From: Craftplacer Date: Wed, 28 Apr 2021 09:27:50 +0200 Subject: [PATCH] Add drag drop support for notifications with file name --- ShareX/Forms/NotificationForm.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ShareX/Forms/NotificationForm.cs b/ShareX/Forms/NotificationForm.cs index 60298c4f5..0644b7d78 100644 --- a/ShareX/Forms/NotificationForm.cs +++ b/ShareX/Forms/NotificationForm.cs @@ -26,6 +26,7 @@ You should have received a copy of the GNU General Public License using ShareX.HelpersLib; using System; using System.Drawing; +using System.IO; using System.Windows.Forms; namespace ShareX @@ -361,6 +362,16 @@ private void NotificationForm_MouseLeave(object sender, EventArgs e) } } + private void NotificationForm_MouseDown(object sender, MouseEventArgs e) + { + if (!string.IsNullOrEmpty(Config.FilePath) && File.Exists(Config.FilePath)) + { + IDataObject dataObject = new DataObject(DataFormats.FileDrop, new string[] { Config.FilePath }); + DoDragDrop(dataObject, DragDropEffects.Copy | DragDropEffects.Move); + } + + } + #region Windows Form Designer generated code private Timer tDuration; @@ -412,6 +423,7 @@ private void InitializeComponent() MouseClick += new MouseEventHandler(NotificationForm_MouseClick); MouseEnter += new EventHandler(NotificationForm_MouseEnter); MouseLeave += new EventHandler(NotificationForm_MouseLeave); + MouseDown += new MouseEventHandler(NotificationForm_MouseDown); ResumeLayout(false); }