using DevExpress.XtraEditors; using Ips.Library.Basic; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Ips.Library.DxpLib { public static class EditorExtensions { public static void EnableDragDropFile(this TextEdit textBox) { textBox.AllowDrop = true; textBox.DragDrop += TextBox_DragDrop; textBox.DragOver += TextBox_DragOver; } private static void TextBox_DragOver(object sender, DragEventArgs e) { e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None; } private static void TextBox_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); var self = sender as TextEdit; if (files != null && files.Length != 0) { self.Text = files.JoinAsString(";"); } } } }