質問編集履歴

2

質問に対しての追記

2022/04/20 01:46

投稿

kntm
kntm

スコア58

test CHANGED
File without changes
test CHANGED
@@ -49,3 +49,24 @@
49
49
  explorerBrowser1.Navigate(folder);
50
50
  }
51
51
  ```
52
+ ---
53
+ 質問で教えて頂いたサイトを参考にListViewを使用し実装してみました。
54
+ 複数選択している状態での処理がわからずfor文の中は不完全です。
55
+ ```C#
56
+ private void ListView_ItemDrag(object sender, ItemDragEventArgs e)
57
+ {
58
+ string imgdir = $"{OneDrivePath}\\test\\images\\";
59
+ int items = ListView.SelectedItems.Count;
60
+ for (int i = 0; i < selecteditems; i++)
61
+ {
62
+ DataObject dataObj = new DataObject(DataFormats.FileDrop, $"{imgdir}{ListView.SelectedItems[i].Text});
63
+ Console.WriteLine($"{imgdir}{ListView.SelectedItems[i].Text})
64
+ // C:\Users\test\OneDrive\test\images\test.jpg
65
+ DragDropEffects effect =
66
+ DragDropEffects.Copy | DragDropEffects.Move;
67
+ ListView.DoDragDrop(dataObj, effect);
68
+ }
69
+ }
70
+ ```
71
+ こちらの処理で単体のファイルを他アプリケーションへD&Dしてみましたが、マウスカーソルが変化はしますがそれ以外のことは何も起きませんでした。
72
+ ブラウザ上のファイル選択エリアへD&Dも結果は同じです。

1

コードの修正

2022/04/19 07:55

投稿

kntm
kntm

スコア58

test CHANGED
File without changes
test CHANGED
@@ -47,4 +47,5 @@
47
47
 
48
48
  // 指定したディレクトリを表示
49
49
  explorerBrowser1.Navigate(folder);
50
+ }
50
51
  ```