Cycle de progression Faire (quelque chose qui marche) -> comprendre ce que l’on fait/comment cela marche -> pousser plus loin les notions
| public string[] DropFiles; private void GetDropFiles(DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { DropFiles = (string[])e.Data.GetData(DataFormats.FileDrop); e.Effect = System.Windows.Forms.DragDropEffects.Move; } } private string GetDropFile(int Index) { string DropFile = string.Empty; if (DropFiles.Length == 0 || DropFiles.Length - 1 < Index) { } else DropFile = DropFiles[Index]; return DropFile; } |
| private void treeView1_DragEnter(object sender, DragEventArgs e) { GetDropFiles(e); } private void treeView1_DragDrop(object sender, DragEventArgs e) { try { string DropFile = GetDropFile(0); if (!string.IsNullOrEmpty(DropFile)) LoadFromFile.BeginInvoke(DropFile, null, null); } catch { } } |