Код: Выделить всё
// FormA.cs
private void g_SelectionDrag(object sender, CancelEventArgs e)
{
string path = Path.ChangeExtension(Path.Combine(Path.GetTempFilePath(), Guid.NewGuid().ToString()), ".txt");
DataObject dobj = new DataObject();
dobj.SetData(DataFormats.FileDrop, new string[] { path });
// only possibility?
// dobj.SetData("MyFormat", new object[2] { this, path });
g.DoDragDrop(dobj, DragDropEffects.Copy);
}
// FormB.cs
void c_DragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop, true) && (e.Data.GetData(DataFormats.FileDrop, true) != null))
{
String[] SelectedFiles = (String[])e.Data.GetData(DataFormats.FileDrop);
// do things with the file
}
}
-единственная возможностей, чтобы пройти этот incale-presectAl или я могу получить источник где -нибудь еще?
Подробнее здесь: https://stackoverflow.com/questions/796 ... -drag-drop
Мобильная версия