1 2 3 4 5 6 7 8 9 10 11 | void CopyToClipboard(string[] files, bool cut) { if (files == null) return; IDataObject data = new DataObject(DataFormats.FileDrop, files); MemoryStream memo = new MemoryStream(4); byte[] bytes = new byte[] { (byte)(cut ? 2 : 5), 0, 0, 0 }; memo.Write(bytes, 0, bytes.Length); data.SetData("Preferred DropEffect", memo); Clipboard.SetDataObject(data); } |
参考自:https://www.codeproject.com/kb/shell/explorer_drag_drop.aspx