Leggere i possibili formati di lettura in clipboard:
-
private string GetFormatsInClipboard()
-
{
-
StringBuilder sb =
new StringBuilder
();
-
IDataObject dataClipboard = Clipboard.GetDataObject();
-
if ((dataClipboard != null))
-
{
-
foreach (string item in dataClipboard.GetFormats(true))
-
{
-
sb.AppendFormat("{0}\r\n", item);
-
}
-
}
-
return sb.ToString();
-
}
-
Drag&Drop di un file in una TextBox per averne il path:
-
private void txtPathFile_DragEnter(object sender, DragEventArgs e)
-
{
-
if (e.Data.GetDataPresent(DataFormats.FileDrop))
-
e.Effect = DragDropEffects.Copy;
-
else
-
e.Effect = DragDropEffects.None;
-
-
}
-
private void txtPathFile_DragDrop(object sender, DragEventArgs e)
-
{
-
string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false);
-
-
if (FileList != null && FileList.Length > 0)
-
txtPathFile.Text = FileList[0];
-
}
-