回答編集履歴

1

getFileNameToDragEventが抜けていたので修正

2019/04/22 07:56

投稿

BluOxy
BluOxy

スコア2663

test CHANGED
@@ -8,9 +8,21 @@
8
8
 
9
9
  {
10
10
 
11
- string fileName = this.getFileNameToDragEvent(e);
11
+ string fileName = getFileNameToDragEvent(e);
12
12
 
13
- this.showPicture(fileName);
13
+ pictureBox1.ImageLocation = fileName;
14
+
15
+ }
16
+
17
+
18
+
19
+ private string getFileNameToDragEvent(DragEventArgs e)
20
+
21
+ {
22
+
23
+ string[] fileName = (string[])e.Data.GetData(DataFormats.FileDrop);
24
+
25
+ return System.IO.File.Exists(fileName[0])) ? fileName[0] : null;
14
26
 
15
27
  }
16
28