The code dragged over the file is:
(System.Array) e.Data.GetData (DataFormats.FileDrop)
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.IO;usingSystem.Security.Cryptography; namespacewindowsformsapplication1{ Public Partial classMd5:form { PublicMD5 () {InitializeComponent (); } Private voidMd5_load (Objectsender, EventArgs e) {Setctrldrag.setctrldragevent ( This. TextBox1); } } Public classSetctrldrag { Public Static voidsetctrldragevent (Control ctrl) {if(Ctrl isTextBox) {TextBox TB= Ctrl asTextBox; Tb. AllowDrop=true; Tb. DragEnter+ = (sender, e) = ={e.effect= Dragdropeffects.link;//icon when dragging }; Tb. DragDrop+ = (sender, e) = ={(TextBox) sender. Text="file path:"+ ((System.Array) e.Data.GetData (DataFormats.FileDrop)). GetValue (0). ToString (); }; } } } }
Drag a file to the control to get the file path