private void pbPreview_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { Trace.WriteLine("Starting drag operation...", string.Format("PeekPreview.pbPreview_MouseDown [{0}]", System.Threading.Thread.CurrentThread.Name)); DragThumb = new DragDropThumb(pbPreview.Image); DragThumb.Show(); string TargetDirectory = Path.GetDirectoryName(CurrentScreenshot.InternalFileName); if (!Directory.Exists(TargetDirectory)) { Directory.CreateDirectory(TargetDirectory); } var DropFileType = new[] { ImageFormat.Png, ImageFormat.Bmp, ImageFormat.Jpeg, ImageFormat.Gif }[Configuration.DefaultFilterIndex]; var DropFileName = CurrentScreenshot.InternalFileName.Substring(0, CurrentScreenshot.InternalFileName.LastIndexOf('.')) + "." + DropFileType.ToString().ToLower(); CurrentScreenshot.ComposedScreenshotImage.Save(DropFileName, DropFileType); var r = pbPreview.DoDragDrop(new DataObject(DataFormats.FileDrop, new string[] { DropFileName }), DragDropEffects.Copy); DragThumb.Close(); Trace.WriteLine("Drag operation complete.", string.Format("PeekPreview.pbPreview_MouseDown [{0}]", System.Threading.Thread.CurrentThread.Name)); } }
private void pbPreview_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { Trace.WriteLine("Starting drag operation...", string.Format("PeekPreview.pbPreview_MouseDown [{0}]", System.Threading.Thread.CurrentThread.Name)); DragThumb = new DragDropThumb(pbPreview.Image); DragThumb.Show(); string TargetDirectory = Path.GetDirectoryName(CurrentScreenshot.InternalFileName); if (!Directory.Exists(TargetDirectory)) Directory.CreateDirectory(TargetDirectory); var DropFileType = new[] { ImageFormat.Png, ImageFormat.Bmp, ImageFormat.Jpeg, ImageFormat.Gif }[Configuration.DefaultFilterIndex]; var DropFileName = CurrentScreenshot.InternalFileName.Substring(0, CurrentScreenshot.InternalFileName.LastIndexOf('.')) + "." + DropFileType.ToString().ToLower(); CurrentScreenshot.ComposedScreenshotImage.Save(DropFileName, DropFileType); var r = pbPreview.DoDragDrop(new DataObject(DataFormats.FileDrop, new string[] { DropFileName }), DragDropEffects.Copy); DragThumb.Close(); Trace.WriteLine("Drag operation complete.", string.Format("PeekPreview.pbPreview_MouseDown [{0}]", System.Threading.Thread.CurrentThread.Name)); } }