{"id":3073,"date":"2020-02-12T16:24:53","date_gmt":"2020-02-12T07:24:53","guid":{"rendered":"http:\/\/kats-eye.net\/info\/?p=3073"},"modified":"2020-02-13T14:21:30","modified_gmt":"2020-02-13T05:21:30","slug":"c-list%e2%80%90image-03","status":"publish","type":"post","link":"https:\/\/kats-eye.net\/info\/2020\/02\/12\/c-list%e2%80%90image-03\/","title":{"rendered":"C# ListView  \u30de\u30a6\u30b9\u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u64cd\u4f5c"},"content":{"rendered":"<p>&nbsp;<\/p>\n<table style=\"width: 100%; border-collapse: collapse; border-style: none; height: 27px;\" border=\"1\">\n<tbody>\n<tr style=\"height: 30px; border-bottom: 3px #0000ff solid;\">\n<td style=\"width: 1.5%; border-style: none; background-color: #0000ff; height: 27px;\"><\/td>\n<td style=\"width: 2.63291%; border-style: none; height: 27px; background-color: #ffffff;\"><\/td>\n<td style=\"border-style: none; height: 27px; background-color: #ffffff; width: 96.2025%;\"><span style=\"font-family: verdana, geneva, sans-serif;\"><strong><span style=\"font-size: 18pt; color: #0000ff;\">C# listView\u00a0 \u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7<\/span><\/strong><\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-size: 14pt;\">\u3000\u5148\u56de listView \u3068 imageList \u3092\u4f7f\u3063\u3066\u30b5\u30e0\u30cd\u30a4\u30eb\u753b\u50cf\u8868\u793a\u30fb\u8ffd\u52a0\u30fb\u633f\u5165\u30fb\u524a\u9664\u306a\u3069\u306e\u57fa\u672c\u6a5f\u80fd\u3092\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002\u4eca\u56de\u306f listView \u306b\u8868\u793a\u3057\u305f\u753b\u50cf\u3092\u30de\u30a6\u30b9\u306e\u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u64cd\u4f5c\u3067\u4f4d\u7f6e\u3092\u5909\u66f4\u3057\u305f\u308a\u3001\u30b3\u30d4\u30fc\u3059\u308b\u51e6\u7406\u306b\u3064\u3044\u3066\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002<\/span><\/p>\n<table style=\"width: 100%; border-collapse: collapse; border-style: none; height: 27px;\" border=\"1\">\n<tbody>\n<tr style=\"height: 30px; border-bottom: 3px #0000ff solid;\">\n<td style=\"width: 1.5%; border-style: none; background-color: #0000ff; height: 27px;\"><\/td>\n<td style=\"width: 2.63291%; border-style: none; height: 27px; background-color: #ffffff;\"><\/td>\n<td style=\"border-style: none; height: 27px; background-color: #ffffff; width: 96.2025%;\"><span style=\"font-family: verdana, geneva, sans-serif;\"><strong><span style=\"font-size: 18pt; color: #0000ff;\">listView\u00a0 \u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u64cd\u4f5c<\/span><\/strong><\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-size: 14pt;\">\u3000\u6b21\u306e\uff08\uff11\uff09\uff5e\uff08\uff14\uff09\u306e\u56f3\u3067\u6a5f\u80fd\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<br \/>\n<span style=\"text-decoration: underline;\">\uff08\uff11\uff09\u8d77\u52d5\u76f4\u5f8c\u306e\u72b6\u614b<\/span><br \/>\n<span style=\"font-size: 14pt;\">\u3000\u6307\u5b9a\u30d5\u30a9\u30eb\u30c0\u30fc\u306e\u753b\u50cf\u3092\u8868\u793a\u3057\u305f\u8d77\u52d5\u76f4\u5f8c\u306e\u72b6\u614b\u3067\u3059\u3002\u6700\u4e0a\u6bb5\u90e8\u306e\u300c\u79fb\u52d5\u4f4d\u7f6e\u300d\u306f\u753b\u50cf\u30c9\u30e9\u30c3\u30b0\u958b\u59cb\u5f8c\u3001\u30de\u30a6\u30b9\u304c\u3069\u306e\u753b\u50cf\u4ed8\u8fd1\u306b\u3042\u308b\u304b\u3092\u8868\u793a\u3057\u307e\u3059\u3002\u4e0b\u56f3\u306e\u5834\u5408\u306f\u3001No[1]\u2192\u201c0\u201d\uff0cNo[2]\u2192\u201c1\u201d \u3068\u3001\u756a\u53f7\u304b\u3089\uff11\u3092\u5f15\u3044\u305f\u5024\u304c\u300c\u79fb\u52d5\u4f4d\u7f6e\u300d\u306b\u306a\u308a\u307e\u3059\u3002<\/span><br \/>\n<\/span><span style=\"font-size: 14pt;\"><span style=\"font-size: 14pt;\">\u3000\u4e2d\u9593\u4f4d\u7f6e\u306f\u3001No[1]\uff5eNo[10]\u306e\u753b\u50cf\u306e\u9593\u306b\u8868\u793a\u3055\u308c\u3066\u3044\u308b \u24ea\uff5e\u2469\u306e\u756a\u53f7\u4f4d\u7f6e\u3067\u3059\u3002\uff08\u5b9f\u969b\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u306f\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002\uff09\u3000\u4e2d\u9593\u4f4d\u7f6e\u306f\u79fb\u52d5\u4f4d\u7f6e\u306e\u753b\u50cf\u306b\u5bfe\u3057\u3001\u30de\u30a6\u30b9\u304c\u5de6\u5074\u306b\u3042\u308b\u6642\u306f\u540c\u3058\u5024\u3001\u53f3\u5074\u306b\u3042\u308b\u6642\u306f\uff11\u52a0\u7b97\u3055\u308c\u305f\u5024\u306b\u306a\u308a\u307e\u3059\u3002<\/span><br \/>\n<span style=\"font-size: 14pt;\">\u3000\u753b\u50cf\u30c9\u30e9\u30c3\u30b0\u4e2d\u306f\u30de\u30a6\u30b9\u30ab\u30fc\u30bd\u30eb\u306e\u4f4d\u7f6e\u304b\u3089\u3001\u753b\u50cf\u306e\u79fb\u52d5\u4f4d\u7f6e\u3001\u4e2d\u9593\u4f4d\u7f6e\u3092\u7e70\u308a\u8fd4\u3057\u53d6\u5f97\u30fb\u66f4\u65b0\u3057\u307e\u3059\u3002<\/span><br \/>\n<\/span><span style=\"font-size: 14pt;\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-3079\" src=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/001-1.png\" alt=\"\" width=\"966\" height=\"557\" srcset=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/001-1.png 966w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/001-1-300x173.png 300w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/001-1-768x443.png 768w\" sizes=\"(max-width: 966px) 100vw, 966px\" \/><span style=\"text-decoration: underline;\"><br \/>\n\uff08\uff12\uff09\u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u64cd\u4f5c<br \/>\n<\/span><span style=\"font-size: 14pt;\">\u3000\u6b21\u306e\u4f8b\u3067\u306f\u3001No[2]\u306e\u753b\u50cf\u3092\u30c9\u30e9\u30c3\u30b0\uff08\u30de\u30a6\u30b9\u5de6\u30dc\u30bf\u30f3\u62bc\u4e0b\uff09\u3057\u3001\u4e2d\u9593\u4f4d\u7f6e\u2466\u3067\u30c9\u30ed\u30c3\u30d7\uff08\u30dc\u30bf\u30f3\u3092\u96e2\u3059\uff09\u3057\u307e\u3059\u3002\u30c9\u30e9\u30c3\u30b0\u4e2d\u3001\u4e2d\u9593\u4f4d\u7f6e\u306b InsertionMark\uff08\u633f\u5165\u30de\u30fc\u30af\uff09\u304c\u8868\u793a\u3055\u308c\u3001\u633f\u5165\u4f4d\u7f6e\u304c\u8996\u899a\u7684\u306b\u78ba\u8a8d\u3067\u304d\u308b\u69d8\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/span><br \/>\n<img loading=\"lazy\" class=\"aligncenter size-full wp-image-3080\" src=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/002-1.png\" alt=\"\" width=\"965\" height=\"558\" srcset=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/002-1.png 965w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/002-1-300x173.png 300w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/002-1-768x444.png 768w\" sizes=\"(max-width: 965px) 100vw, 965px\" \/><br \/>\n<span style=\"text-decoration: underline;\">\uff08\uff13\uff09\u51e6\u7406\u7d50\u679c<\/span><br \/>\n<\/span><span style=\"font-size: 14pt;\"><span style=\"font-size: 14pt;\">\u00a0 \u00a0 \u00a0<span style=\"text-decoration: underline;\">(a) \u79fb\u52d5\u51e6\u7406<\/span><br \/>\n<\/span>\u3000\u4e0b\u56f3\u306e\u901a\u308a\u3001No[2]\u753b\u50cf\u306f\u3001\u4e2d\u9593\u4f4d\u7f6e\u2466\u306b\u79fb\u52d5\u3057\u307e\u3059\u3002\u5143\u306eNo[2]\u753b\u50cf\u306f\u7121\u304f\u306a\u308a\u3001No[2]\u753b\u50cf\u306f\u79fb\u52d5\u5f8c\uff11\u3064\u524d\u306b\u305a\u308c\u307e\u3059\u3002<br \/>\n<img loading=\"lazy\" class=\"aligncenter size-full wp-image-3081\" src=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/003-1.png\" alt=\"\" width=\"967\" height=\"557\" srcset=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/003-1.png 967w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/003-1-300x173.png 300w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/003-1-768x442.png 768w\" sizes=\"(max-width: 967px) 100vw, 967px\" \/><span style=\"text-decoration: underline;\"><br \/>\n<\/span>\u00a0 \u00a0 \u00a0<span style=\"text-decoration: underline;\">(b) \u30b3\u30d4\u30fc\u51e6\u7406<\/span><br \/>\n<span style=\"font-size: 14pt;\">\u3000\u30b3\u30d4\u30fc\u306f\u30c9\u30ed\u30c3\u30d7\u3059\u308b\u6642\u306b\u300cCTRL\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3053\u3068\u3067\u53ef\u80fd\u3067\u3059\u3002\u4e0b\u56f3\u306e\u901a\u308a\u3001No[2]\u753b\u50cf\u306f\u3001\u4e2d\u9593\u4f4d\u7f6e\u2466\u306b\u30b3\u30d4\u30fc\u3055\u308c\u3001\u5143\u306eNo[2]\u753b\u50cf\u3082\u6b8b\u3063\u305f\u72b6\u614b\u3067\u3059\u3002<\/span><br \/>\n<img loading=\"lazy\" class=\"aligncenter size-full wp-image-3082\" src=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/004-1.png\" alt=\"\" width=\"968\" height=\"559\" srcset=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/004-1.png 968w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/004-1-300x173.png 300w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/004-1-768x444.png 768w\" sizes=\"(max-width: 968px) 100vw, 968px\" \/><br \/>\n<\/span><\/p>\n<table style=\"width: 100%; border-collapse: collapse; border-style: none; height: 27px;\" border=\"1\">\n<tbody>\n<tr style=\"height: 30px; border-bottom: 3px #0000ff solid;\">\n<td style=\"width: 1.5%; border-style: none; background-color: #0000ff; height: 27px;\"><\/td>\n<td style=\"width: 2.63291%; border-style: none; height: 27px; background-color: #ffffff;\"><\/td>\n<td style=\"border-style: none; height: 27px; background-color: #ffffff; width: 96.2025%;\"><span style=\"font-family: verdana, geneva, sans-serif;\"><strong><span style=\"font-size: 18pt; color: #0000ff;\">\u30d7\u30ed\u30b0\u30e9\u30e0\u6982\u8981<span style=\"font-size: 14pt;\">\uff08SingleSelect\u5bfe\u5fdc\uff09<\/span><\/span><\/strong><\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-size: 14pt;\">\u3000\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u3064\u3044\u3066\u8981\u70b9\u3092\u4e0b\u306e\u8868\u306b\u6574\u7406\u3057\u307e\u3059\u3002<\/span><\/p>\n<table style=\"height: 293px; width: 100%; border-collapse: collapse; border-style: none;\" border=\"1\">\n<tbody>\n<tr>\n<td style=\"width: 5.16875%; border-style: none; border-color: #ffffff; text-align: center;\"><span style=\"font-size: 12pt;\">\u00a0<\/span><\/td>\n<td style=\"width: 14.4514%; background-color: #ffffff; border-style: none; border-color: #000000; text-align: left;\" colspan=\"2\"><span style=\"font-size: 12pt;\">\u8868\uff1a\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u884c\u756a\u53f7\u3068\u5185\u5bb9<\/span><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 5.16875%; border-style: none; border-color: #ffffff; height: 25px; text-align: center;\"><span style=\"font-size: 12pt;\">\u00a0<\/span><\/td>\n<td style=\"width: 14.4514%; height: 25px; background-color: #bdb5b5; text-align: center; border-style: solid; border-color: #000000;\"><span style=\"font-size: 12pt;\">\u884c<\/span><\/td>\n<td style=\"width: 80.3798%; height: 25px; background-color: #bdb5b5; border-style: solid; border-color: #000000; text-align: center;\"><span style=\"font-size: 12pt;\">\u5185\u3000\u5bb9<\/span><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 5.16875%; text-align: center; border-style: none; border-color: #ffffff; height: 49px;\"><span style=\"font-size: 12pt;\">\u00a0<\/span><\/td>\n<td style=\"width: 14.4514%; height: 49px; text-align: center; border-style: solid; border-color: #000000;\"><span style=\"font-size: 12pt;\">31-36<\/span><\/td>\n<td style=\"width: 80.3798%; height: 49px; border-style: solid; border-color: #000000;\"><span style=\"font-size: 12pt;\">listView\u306eDrop\u51e6\u7406\u8a31\u53ef<\/span><br \/>\n<span style=\"font-size: 12pt;\">\u30de\u30a6\u30b9\u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u306e\u30a4\u30d9\u30f3\u30c8\u8ffd\u52a0<\/span><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 5.16875%; text-align: center; border-style: none; border-color: #ffffff; height: 25px;\"><span style=\"font-size: 12pt;\">\u00a0<\/span><\/td>\n<td style=\"width: 14.4514%; height: 25px; text-align: center; border-style: solid; border-color: #000000;\"><span style=\"font-size: 12pt;\">42<\/span><\/td>\n<td style=\"width: 80.3798%; height: 25px; border-style: solid; border-color: #000000;\"><span style=\"font-size: 12pt;\">\u30de\u30a6\u30b9\u30c9\u30e9\u30c3\u30b0\u6642\u3001\u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u51e6\u7406\u958b\u59cb<\/span><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 5.16875%; text-align: center; border-style: none; border-color: #ffffff; height: 49px;\"><span style=\"font-size: 12pt;\">\u00a0<\/span><\/td>\n<td style=\"width: 14.4514%; height: 49px; text-align: center; border-style: solid; border-color: #000000;\"><span style=\"font-size: 12pt;\">60,64<\/span><\/td>\n<td style=\"width: 80.3798%; height: 49px; border-style: solid; border-color: #000000;\"><span style=\"font-size: 12pt;\">CTRL\u5165\u529b\u72b6\u614b\u306b\u3088\u308a\u3001Copy\uff0cMove\u3092\u9078\u629e<\/span><br \/>\n<span style=\"font-size: 12pt;\">\u2192\u30c9\u30e9\u30c3\u30b0\u4e2d\u306b\u30ab\u30fc\u30bd\u30eb\u4ed8\u8fd1\u306e\u8868\u793a\u304c\u5909\u5316\u3059\u308b<\/span><\/td>\n<\/tr>\n<tr style=\"height: 49px;\">\n<td style=\"width: 5.16875%; text-align: center; border-style: none; border-color: #ffffff; height: 49px;\"><\/td>\n<td style=\"width: 14.4514%; text-align: center; height: 49px; border-style: solid; border-color: #000000;\">68,71<\/td>\n<td style=\"width: 80.3798%; border-style: solid; border-color: #000000; height: 49px;\">\u30de\u30a6\u30b9\u30ab\u30fc\u30bd\u30eb\u4f4d\u7f6e\u306b\u8fd1\u3044\u3001listView\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u3092\u53d6\u5f97\u3059\u308b<\/td>\n<\/tr>\n<tr style=\"height: 49px;\">\n<td style=\"width: 5.16875%; text-align: center; border-style: none; border-color: #ffffff; height: 22px;\"><\/td>\n<td style=\"width: 14.4514%; text-align: center; height: 22px; border-style: solid; border-color: #000000;\">92,97,<br \/>\n103<\/td>\n<td style=\"width: 80.3798%; border-style: solid; border-color: #000000; height: 22px;\">\u30de\u30a6\u30b9\u30ab\u30fc\u30bd\u30eb\u304c\u5bfe\u8c61\u753b\u50cf\u306e\u5de6\u5074\u304b\u53f3\u5074\u304b\u3067InsertionMark\uff08\u633f\u5165\uff8f\uff70\uff78\uff09\u8868\u793a\u4f4d\u7f6e\u4fee\u6b63\u30fb\u8868\u793a<\/td>\n<\/tr>\n<tr style=\"height: 49px;\">\n<td style=\"width: 5.16875%; text-align: center; border-style: none; border-color: #ffffff; height: 49px;\"><\/td>\n<td style=\"width: 14.4514%; text-align: center; height: 49px; border-style: solid; border-color: #000000;\">139<\/td>\n<td style=\"width: 80.3798%; border-style: solid; border-color: #000000; height: 49px;\">InsertionMark\uff08\u633f\u5165\uff8f\uff70\uff78\uff09\u540c\u69d8\u306b\u633f\u5165\u4f4d\u7f6e\u3092\u53d6\u5f97\u3057\u3001\u753b\u50cf\u633f\u5165<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 5.16875%; text-align: center; border-style: none; border-color: #ffffff; height: 25px;\"><\/td>\n<td style=\"width: 14.4514%; height: 25px; text-align: center; border-style: solid; border-color: #000000;\">144<\/td>\n<td style=\"width: 80.3798%; height: 25px; border-style: solid; border-color: #000000;\">\u79fb\u52d5\u51e6\u7406\u6642\u306f\u79fb\u52d5\u5143\u753b\u50cf\u62b9\u6d88<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-size: 14pt;\"><span style=\"font-size: 14pt;\"><br \/>\n<span style=\"font-size: 14pt;\">\u3000\u30d7\u30ed\u30b0\u30e9\u30e0\u5185\u306b\u306f\u3001\u4eca\u56de\u8abf\u67fb\u5185\u5bb9\u306e\u4e2d\u3067\u4eca\u5f8c\u81ea\u5206\u3067\u4f7f\u3046\u53ef\u80fd\u6027\u304c\u3042\u308a\u305d\u3046\u306a\u3082\u306e\u3082\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3057\u6b8b\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u3054\u5bb9\u8d66\u4e0b\u3055\u3044\u3002<\/span><\/span><\/span><\/p>\n<pre class=\"height-set:true lang:c# mark:31,33-36,42,60,64,68,71,92,97,103,139,144 decode:true\" title=\"ListViewTest.sln MouseOperationTest\">using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Data;\r\nusing System.Drawing;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\nusing System.Windows.Forms;\r\n\r\nusing System.IO;\r\n\r\nnamespace ListViewTest\r\n{\r\n    public partial class Form2 : Form\r\n    {\r\n        public Form2()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void Form2_Load(object sender, EventArgs e)\r\n        {\r\n            listView1_init();\r\n            get_pic_thumbnail();\r\n            chk_listView1(0);\r\n        }\r\n\r\n        private void listView1_init() {\r\n            listView1.LargeImageList = imageList1;\r\n            listView1.AllowDrop = true ;\r\n\r\n            listView1.ItemDrag += new ItemDragEventHandler(listView1_ItemDrag);\r\n            listView1.DragEnter += new DragEventHandler(listView1_DragEnter);\r\n            listView1.DragOver += new DragEventHandler(listView1_DragOver);\r\n            listView1.DragDrop += new DragEventHandler(listView1_DragDrop);\r\n\r\n        }\r\n\r\n        \/\/ \u2460\u30c9\u30e9\u30c3\u30b0\u6642\uff11\u56de\u767a\u751f\u3059\u308b\u30a4\u30d9\u30f3\u30c8\r\n        private void listView1_ItemDrag(Object sender, ItemDragEventArgs e) {\r\n            listView1.DoDragDrop((ListViewItem)e.Item, DragDropEffects.Copy | DragDropEffects.Move);\r\n        }\r\n\r\n        \/\/ \u2461\u30c9\u30e9\u30c3\u30b0\u958b\u59cb\uff08\u79fb\u52d5\u958b\u59cb\uff09\u76f4\u5f8c\uff11\u56de\u767a\u751f\u3059\u308b\u30a4\u30d9\u30f3\u30c8\r\n        private void listView1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)\r\n        {\r\n            \/\/ listView1_DragOver\u30a4\u30d9\u30f3\u30c8\u306b\u3066\u51e6\u7406\r\n        }\r\n\r\n        \/\/ \u2462\u30a2\u30a4\u30c6\u30e0\u30c9\u30e9\u30c3\u30b0\u4e2d\u306b\u7e70\u308a\u8fd4\u3057\u767a\u751f\u3059\u308b\u30a4\u30d9\u30f3\u30c8\r\n        \/\/ InsertionMark\uff08\u633f\u5165\u4f4d\u7f6e\uff09\u3092\u5165\u308c\u308b\r\n        private void listView1_DragOver(object sender, System.Windows.Forms.DragEventArgs e)\r\n        {\r\n            if (e.Data.GetDataPresent(typeof(ListViewItem)))\r\n            {\r\n                if ((e.KeyState &amp; 0x1) &gt; 0 &amp;&amp; (e.KeyState &amp; 0x8) &gt; 0)\r\n                {   \/\/ 0x1(1):\uff8f\uff73\uff7d\u5de6\uff0c0x2(2):\uff8f\uff73\uff7d\u53f3,0x4(4):Shift,0x8(8):CTRL,0x10(16):\uff8f\uff73\uff7d\u4e2d\u592e,0x20(32):ALT\r\n                    \/\/ \uff8f\uff73\uff7d\u5de6\uff0bCTRL\r\n                    e.Effect = DragDropEffects.Copy;\r\n                }\r\n                else\r\n                {\r\n                    e.Effect = DragDropEffects.Move;\r\n                }\r\n\r\n                \/\/ Retrieve the client coordinates of the mouse pointer.\r\n                Point targetPoint = listView1.PointToClient(new Point(e.X, e.Y));\r\n\r\n                \/\/ Retrieve the index of the item closest to the mouse pointer.\r\n                int targetIndex = listView1.InsertionMark.NearestIndex(targetPoint);\r\n                int ins_p_Index = targetIndex;                              \/\/ \u4e2d\u9593\u4f4d\u7f6e\r\n\r\n                \/\/ \u2605\u4e0b\u8a18\u306f\u78ba\u8a8d\u30fb\u691c\u8a3c\u7528(\u30a2\u30a4\u30c6\u30e0\u30d7\u30ed\u30d1\u30c6\u30a3\u53d6\u5f97\u306e\u53c2\u8003\u306b\u306a\u308b\u306e\u3067\u6b8b\u3057\u3066\u3044\u308b)\r\n                \/\/ListViewItem srcItem = (ListViewItem)e.Data.GetData(typeof(ListViewItem));\r\n                \/\/ListViewItem tgtItem = this.listView1.GetItemAt(targetPoint.X, targetPoint.Y);\r\n                \/\/textBox3.Text = srcItem.Index.ToString() + \" , \" + srcItem.Text + \" , \" + srcItem.ImageIndex.ToString() + \" , \" + srcItem.ImageKey;\r\n                \/\/if (tgtItem != null)\r\n                \/\/{ textBox4.Text = tgtItem.Index.ToString() + \" , \" + tgtItem.Text + \" , \" + tgtItem.ImageIndex.ToString() + \" , \" + tgtItem.ImageKey; }\r\n                \/\/else{ textBox4.Text = \"\"; }\r\n                \r\n                \r\n                \/\/ Confirm that the mouse pointer is not over the dragged item.\r\n                \/\/ \u6700\u8fd1\u30a2\u30a4\u30c6\u30e0\u304c\u3001\u73fe\u30c9\u30e9\u30c3\u30b0\u9805\u76ee\uff08\u81ea\u5206\u81ea\u8eab\uff09\u306e\u5834\u5408\u306f\u3001-1 \u304c\u8fd4\u3055\u308c\u308b\u3002\r\n                if (targetIndex &gt; -1)\r\n                {\r\n                    \/\/ Determine whether the mouse pointer is to the left or the right of \r\n                    \/\/ the midpoint of the closest item and set the InsertionMark.AppearsAfterItem property accordingly.\r\n                    Rectangle itemBounds = listView1.GetItemRect(targetIndex);\r\n                    if (targetPoint.X &gt; itemBounds.Left + (itemBounds.Width \/ 2))\r\n                    {\r\n                        listView1.InsertionMark.AppearsAfterItem = true;    \/\/ \u8fd1\u3044\u30a2\u30a4\u30c6\u30e0\u5f8c\u65b9\r\n                        ins_p_Index++;                                      \/\/ \u4e2d\u9593\u4f4d\u7f6e\r\n                    }\r\n                    else\r\n                    {\r\n                        listView1.InsertionMark.AppearsAfterItem = false;   \/\/ \u8fd1\u3044\u30a2\u30a4\u30c6\u30e0\u524d\u65b9\r\n                    }\r\n                }\r\n\r\n                \/\/ Set the location of the insertion mark. If the mouse is over the dragged item, \r\n                \/\/ the targetIndex value is -1 and the insertion mark disappears.\r\n                listView1.InsertionMark.Index = targetIndex;\r\n\r\n                textBox1.Text = targetIndex.ToString();                     \/\/ \u79fb\u52d5\u4f4d\u7f6e\r\n                textBox2.Text = ins_p_Index.ToString();                     \/\/ \u4e2d\u9593\u4f4d\u7f6e\r\n            } else {\r\n                textBox1.Text = \"ERR : Not List View Item.\";\r\n            }\r\n        }\r\n\r\n        \/\/ \u2463\u30c9\u30ed\u30c3\u30d7\u6642\uff11\u56de\u767a\u751f\u3059\u308b\u30a4\u30d9\u30f3\u30c8\r\n        private void listView1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)\r\n        {\r\n            if (e.Data.GetDataPresent(typeof(ListViewItem)))\r\n            {\r\n                \/\/ Retrieve the client coordinates of the mouse pointer.\r\n                Point targetPoint = listView1.PointToClient(new Point(e.X, e.Y));\r\n\r\n                \/\/ Retrieve the index of the item closest to the mouse pointer.\r\n                \/\/ ListViewItem tgtItem = this.listView1.GetItemAt(targetPoint.X, targetPoint.Y);   \/\/ \u56f3\u4e0a\u30dd\u30a4\u30f3\u30c8\u6642\u6709\u52b9\r\n                \/\/ int targetIndex = this.listView1.Items.IndexOf(tgtItem);                         \/\/ \u2192\u56f3\u306e\u9699\u9593\u306f\u7121\u52b9\r\n                int targetIndex = listView1.InsertionMark.NearestIndex(targetPoint);                \/\/ \u8fd1\u3044\u4f4d\u7f6e\r\n                int ins_p_Index = targetIndex;                                                      \/\/ \u4e2d\u9593\u4f4d\u7f6e\r\n\r\n                ListViewItem srcItem = (ListViewItem)e.Data.GetData(typeof(ListViewItem));\r\n                  \r\n                if (targetIndex &gt; -1)\r\n                {\r\n                    \/\/ Determine whether the mouse pointer is to the left or the right of \r\n                    \/\/ the midpoint of the closest item and set the InsertionMark.AppearsAfterItem property accordingly.\r\n                    Rectangle itemBounds = listView1.GetItemRect(targetIndex);\r\n                    if (targetPoint.X &gt; itemBounds.Left + (itemBounds.Width \/ 2))\r\n                    {\r\n                        ins_p_Index++;                                                              \/\/ \u4e2d\u9593\u4f4d\u7f6e\r\n                    }\r\n\r\n                    \/\/ \u78ba\u5b9a\u4f4d\u7f6e\u306b\u633f\u5165\r\n                    ListViewItem newItem = this.listView1.Items.Insert(ins_p_Index, srcItem.Text, srcItem.ImageIndex);\r\n                    newItem.Selected = true;\r\n\r\n                    \/\/ \u79fb\u52d5\u6642\u30bd\u30fc\u30b9\u30a2\u30a4\u30c6\u30e0\u524a\u9664\r\n                    if ((e.KeyState &amp; 0x8) &lt;= 0){\r\n                        this.listView1.Items.Remove(srcItem);\r\n                    }\r\n                        \r\n                    chk_listView1(1);                                                               \/\/ \u518d\u63cf\u753b                                       \r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        \/\/ \u30b5\u30e0\u30cd\u30a4\u30eb\u753b\u50cf\u53d6\u5f97\u30fblistView\u8868\u793a\r\n        private void get_pic_thumbnail()\r\n        {\r\n            string imageDir = @\"\"; \/\/ \u753b\u50cf\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\r\n            string[] jpgFiles = System.IO.Directory.GetFiles(imageDir, \"*.PNG\");\r\n\r\n            int width = 80;\r\n            int height = 80;\r\n\r\n            imageList1.ImageSize = new Size(width, height);\r\n            listView1.LargeImageList = imageList1;\r\n\r\n            \/\/ imageList , listView \u767b\u9332\r\n            for (int i = 0; i &lt; jpgFiles.Length; i++)\r\n            {\r\n                String F_Name = Path.GetFileName(jpgFiles[i]);\r\n                Image original = Bitmap.FromFile(jpgFiles[i]);\r\n                Image thumbnail = createThumbnail(original, width, height);\r\n\r\n                imageList1.Images.Add(F_Name, thumbnail);\r\n                \/\/imageList1.Images.Add(thumbnail);\r\n                listView1.Items.Add(F_Name, i);\r\n              \r\n\r\n                original.Dispose();\r\n                thumbnail.Dispose();\r\n            } \r\n        }\r\n\r\n\r\n        \/\/ \u5e45w\u3001\u9ad8\u3055h \u30b5\u30e0\u30cd\u30a4\u30eb\u753b\u50cf\u4f5c\u6210\r\n        Image createThumbnail(Image image, int w, int h)\r\n        {\r\n            Bitmap canvas = new Bitmap(w, h);\r\n\r\n            Graphics g = Graphics.FromImage(canvas);\r\n            g.FillRectangle(new SolidBrush(Color.White), 0, 0, w, h);\r\n\r\n            float fw = (float)w \/ (float)image.Width;\r\n            float fh = (float)h \/ (float)image.Height;\r\n\r\n            float scale = Math.Min(fw, fh);\r\n            fw = image.Width * scale;\r\n            fh = image.Height * scale;\r\n\r\n            g.DrawImage(image, (w - fw) \/ 2, (h - fh) \/ 2, fw, fh);\r\n            g.Dispose();\r\n\r\n            return canvas;\r\n        }\r\n\r\n\r\n        \/\/ \u30a2\u30a4\u30c6\u30e0\u306e\u95a2\u9023\u30d7\u30ed\u30d1\u30c6\u30a3\u53d6\u5f97\u30fb\u518d\u8868\u793a\r\n        private void chk_listView1(int kbn)\r\n        {\r\n            listBox1.Items.Clear();\r\n            \/\/ \u30ea\u30b9\u30c8\u30d3\u30e5\u30fc\uff11(listView1)\u30d7\u30ed\u30d1\u30c6\u30a3\r\n            int listViewCnt1 = listView1.Items.Count;\r\n            string[,] dat_vw1 = new string[listViewCnt1, 4];\r\n            for (int i = 0; i &lt; listViewCnt1; i++)\r\n            {\r\n                dat_vw1[i, 0] = listView1.Items[i].Index.ToString();\r\n                dat_vw1[i, 1] = listView1.Items[i].Text;\r\n                dat_vw1[i, 2] = listView1.Items[i].ImageIndex.ToString();\r\n                dat_vw1[i, 3] = listView1.Items[i].ImageKey;\r\n\r\n                listBox1.Items.Add(dat_vw1[i, 0] + \"  ,  \" + dat_vw1[i, 1] + \"  ,  \" + dat_vw1[i, 2] + \"  ,  \" + dat_vw1[i, 3]);\r\n            }\r\n\r\n            \/\/ listView\u3092\u4e00\u65e6\u521d\u671f\u5316\u3057\u518d\u8868\u793a\u3059\u308b\r\n            if (kbn == 1)\r\n            {\r\n                listView1.Clear();\r\n\r\n                for (int i = 0; i &lt; dat_vw1.GetLength(0); i++)\r\n                {\r\n                    listView1.Items.Add(dat_vw1[i, 1], int.Parse(dat_vw1[i, 2]));\r\n                }\r\n            }\r\n        }\r\n\r\n    }\r\n}\r\n<\/pre>\n<p><span style=\"font-size: 14pt;\">\u00a0<\/span><\/p>\n<table style=\"width: 100%; border-collapse: collapse; border-style: none; height: 27px;\" border=\"1\">\n<tbody>\n<tr style=\"height: 30px; border-bottom: 3px #0000ff solid;\">\n<td style=\"width: 1.5%; border-style: none; background-color: #0000ff; height: 27px;\"><\/td>\n<td style=\"width: 2.63291%; border-style: none; height: 27px; background-color: #ffffff;\"><\/td>\n<td style=\"border-style: none; height: 27px; background-color: #ffffff; width: 96.2025%;\"><span style=\"font-family: verdana, geneva, sans-serif;\"><strong><span style=\"font-size: 18pt; color: #0000ff;\">\u8907\u6570\u9078\u629e\u00a0<span style=\"font-size: 14pt;\">(MultiSelect)\u00a0<\/span>\u30fb\u524a\u9664\u6a5f\u80fd<\/span><\/strong><\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-size: 12pt;\"><span style=\"font-size: 14pt;\">\u3000\u3053\u308c\u307e\u3067\u66f8\u3044\u305f\u6a5f\u80fd\u306b\u753b\u50cf\u30a2\u30a4\u30c6\u30e0\u3092\u8907\u6570\u9078\u629e\u3057\u3001\u79fb\u52d5\u30fb\u30b3\u30d4\u30fc\u30fb\u62b9\u6d88\u3059\u308b\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\u3002\u307e\u305f\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u691c\u8a3c\u306e\u305f\u3081\u201c\u518d\u8aad\u8fbc\u201d\u3082\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059\u3002<\/span><\/span><\/p>\n<p><span style=\"text-decoration: underline; font-size: 14pt;\">\uff08\uff11\uff09\u8907\u6570\u9078\u629e<\/span><br \/>\n<span style=\"font-size: 14pt;\">\u3000\u30a8\u30af\u30b9\u30d7\u30ed\u30fc\u30e9\u30fc\u3068\u540c\u69d8\u306b\u3001[SHIFT]\u30ad\u30fc\u3092\u62bc\u3057\u306a\u304c\u3089\u9023\u7d9a\u9078\u629e\u3001[CTRL]\u30ad\u30fc\u3092\u62bc\u3057\u306a\u304c\u3089\u500b\u5225\u8907\u6570\u9078\u629e\u304c\u51fa\u6765\u307e\u3059\u3002\u4e0b\u56f3\u306f\u3001No\u3014\uff12\u3015\u3014\uff16\u3015\u3014\uff18\u3015\u304c\u9078\u629e\u3055\u308c\u3001\u30c6\u30ad\u30b9\u30c8\u90e8\u304c\u53cd\u8ee2\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u79fb\u52d5\u4f4d\u7f6e\u3014\uff18\u3015\uff08\u4e2d\u9593\u4f4d\u7f6e\u3014\uff19\u3015\uff09\u306bInsertionMark\u304c\u3042\u308a\u307e\u3059\u3002<\/span><br \/>\n<img loading=\"lazy\" class=\"aligncenter size-full wp-image-3108\" src=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/101-1.png\" alt=\"\" width=\"799\" height=\"546\" srcset=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/101-1.png 799w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/101-1-300x205.png 300w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/101-1-768x525.png 768w\" sizes=\"(max-width: 799px) 100vw, 799px\" \/><br \/>\n<span style=\"font-size: 14pt;\"><span style=\"text-decoration: underline;\">\uff08\uff12\uff09\u79fb\u52d5\u30fb\u30b3\u30d4\u30fc\u7d50\u679c<\/span><br \/>\n<span style=\"text-decoration: underline;\">\u2460\u79fb\u52d5\u306e\u5834\u5408<\/span><br \/>\n<span style=\"font-size: 14pt;\">No\u30149\u3015\u301410\u3015\u9593\u306b\u3001No\u30142\u3015\u30146\u3015\u30148\u3015\u3092\u79fb\u52d5<\/span><\/span><br \/>\n<img loading=\"lazy\" class=\"aligncenter size-full wp-image-3109\" src=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/102-1.png\" alt=\"\" width=\"799\" height=\"546\" srcset=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/102-1.png 799w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/102-1-300x205.png 300w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/102-1-768x525.png 768w\" sizes=\"(max-width: 799px) 100vw, 799px\" \/><span style=\"font-size: 14pt;\"><span style=\"text-decoration: underline;\">\u2461\u30b3\u30d4\u30fc\u306e\u5834\u5408<\/span><br \/>\n<span style=\"font-size: 14pt;\">No\u30149\u3015\u301410\u3015\u9593\u306b\u3001No\u30142\u3015\u30146\u3015\u30148\u3015\u3092\u30b3\u30d4\u30fc<\/span><\/span><br \/>\n<img loading=\"lazy\" class=\"aligncenter size-full wp-image-3110\" src=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/103-1.png\" alt=\"\" width=\"799\" height=\"546\" srcset=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/103-1.png 799w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/103-1-300x205.png 300w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/103-1-768x525.png 768w\" sizes=\"(max-width: 799px) 100vw, 799px\" \/><br \/>\n<span style=\"text-decoration: underline;\"><span style=\"font-size: 14pt;\">\uff08\uff13\uff09\u62b9\u6d88\u51e6\u7406<br \/>\n\u2460\u753b\u50cf\u9078\u629e<br \/>\n<\/span><\/span><span style=\"font-size: 14pt;\"><span style=\"font-size: 14pt;\">No\u30145\u3015\u30146\u3015\u30147\u3015\u30148\u3015\u3092\u9078\u629e<\/span><\/span><img loading=\"lazy\" class=\"aligncenter size-full wp-image-3111\" src=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/104.png\" alt=\"\" width=\"799\" height=\"546\" srcset=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/104.png 799w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/104-300x205.png 300w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/104-768x525.png 768w\" sizes=\"(max-width: 799px) 100vw, 799px\" \/><span style=\"text-decoration: underline;\"><span style=\"font-size: 14pt;\">\u2461\u62b9\u6d88<br \/>\n<\/span><\/span><span style=\"font-size: 14pt;\">\u201c\u62b9\u6d88\u201d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3002<br \/>\n<\/span><span style=\"font-size: 14pt;\">No\u30145\u3015\u30146\u3015\u30147\u3015\u30148\u3015\u306f\u6d88\u53bb\u3002<\/span><br \/>\n<img loading=\"lazy\" class=\"aligncenter size-full wp-image-3112\" src=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/105.png\" alt=\"\" width=\"799\" height=\"546\" srcset=\"https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/105.png 799w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/105-300x205.png 300w, https:\/\/kats-eye.net\/info\/wp-content\/uploads\/2020\/02\/105-768x525.png 768w\" sizes=\"(max-width: 799px) 100vw, 799px\" \/><span style=\"font-size: 12pt;\">\u3000\u3000<\/span><\/p>\n<table style=\"width: 100%; border-collapse: collapse; border-style: none; height: 27px;\" border=\"1\">\n<tbody>\n<tr style=\"height: 30px; border-bottom: 3px #0000ff solid;\">\n<td style=\"width: 1.5%; border-style: none; background-color: #0000ff; height: 27px;\"><\/td>\n<td style=\"width: 2.63291%; border-style: none; height: 27px; background-color: #ffffff;\"><\/td>\n<td style=\"border-style: none; height: 27px; background-color: #ffffff; width: 96.2025%;\"><span style=\"font-family: verdana, geneva, sans-serif;\"><strong><span style=\"font-size: 18pt; color: #0000ff;\">\u30d7\u30ed\u30b0\u30e9\u30e0\u6982\u8981\u00a0<span style=\"font-size: 14pt;\">(MultiSelect\u5bfe\u5fdc)<\/span><\/span><\/strong><\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-size: 12pt;\"><span style=\"font-size: 14pt;\">\u3000Single\u5bfe\u5fdc\u3068\u57fa\u672c\u306f\u540c\u3058\u3067\u3059\u304c\u3001\u9078\u629e\u3055\u308c\u3066\u3044\u308b\u753b\u50cf\u6570\u304c\u3001listView\u306e\u00a0 SelectedItems.Count \u3067\u53d6\u5f97\u3067\u304d\u308b\u306e\u3067\u3001\u9078\u629e\u3055\u308c\u3066\u3044\u308b\u753b\u50cf\u306e\u56de\u6570\u5206\u3001Insert\u51e6\u7406\u3068\u79fb\u52d5\u306e\u5834\u5408\u306fRemove\u51e6\u7406\u3092\u7e70\u308a\u8fd4\u3059\u69d8\u306b\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<br \/>\n<span style=\"font-size: 14pt;\">\u3000\u5148\u305a\u884c\u756a35\u3067MultiSelect\u30d7\u30ed\u30d1\u30c6\u30a3\u3092True\u306b\u3057\u307e\u3059\u3002\u884c\u756a143\uff5e192\u3067\u79fb\u52d5\u3068\u30b3\u30d4\u30fc\u7528\u306e\u201cInsert\u201d\u3001\u201cRemove\u201d\u51e6\u7406\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002\u30b7\u30f3\u30b0\u30eb\u306e\u5834\u5408\u3082\u30de\u30eb\u30c1\u306e\u5834\u5408\u3068\u540c\u3058\u51e6\u7406\u3067\u826f\u3044\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u30b7\u30f3\u30b0\u30eb\u5bfe\u5fdc\u306f\u5143\u306e\u65b9\u6cd5\u3092\u6b8b\u3057\u3066\u3044\u307e\u3059\u3002<span style=\"font-size: 14pt;\">\u884c\u756a289\uff5e316\u3067\u306f\u540c\u3058\u8003\u3048\u65b9\u3092\u62b9\u6d88\u51e6\u7406\u306b\u9069\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/span><\/span><\/span><\/span><\/p>\n<pre class=\"height-set:true lang:c# mark:35,143-192,289-316 decode:true\" title=\"ListViewTest.sln MouseOperationTest\">using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Data;\r\nusing System.Drawing;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\nusing System.Windows.Forms;\r\n\r\nusing System.IO;\r\n\r\nnamespace ListViewTest\r\n{\r\n    public partial class Form2 : Form\r\n    {\r\n        public Form2()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void Form2_Load(object sender, EventArgs e)\r\n        {\r\n            listView1_init();\r\n            get_pic_thumbnail();\r\n            chk_listView1(0);\r\n        }\r\n\r\n        private void listView1_init() {\r\n            listView1.Items.Clear();\r\n            imageList1.Images.Clear();\r\n\r\n            listView1.LargeImageList = imageList1;\r\n            listView1.AllowDrop = true ;\r\n            listView1.MultiSelect = true ;\r\n\r\n            listView1.ItemDrag += new ItemDragEventHandler(listView1_ItemDrag);\r\n            listView1.DragEnter += new DragEventHandler(listView1_DragEnter);\r\n            listView1.DragOver += new DragEventHandler(listView1_DragOver);\r\n            listView1.DragDrop += new DragEventHandler(listView1_DragDrop);\r\n\r\n        }\r\n\r\n        \/\/ \u2460\u30c9\u30e9\u30c3\u30b0\u6642\uff11\u56de\u767a\u751f\u3059\u308b\u30a4\u30d9\u30f3\u30c8\r\n        private void listView1_ItemDrag(Object sender, ItemDragEventArgs e) {\r\n            listView1.DoDragDrop((ListViewItem)e.Item, DragDropEffects.Copy | DragDropEffects.Move);\r\n        }\r\n\r\n        \/\/ \u2461\u30c9\u30e9\u30c3\u30b0\u958b\u59cb\uff08\u79fb\u52d5\u958b\u59cb\uff09\u76f4\u5f8c\uff11\u56de\u767a\u751f\u3059\u308b\u30a4\u30d9\u30f3\u30c8\r\n        private void listView1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)\r\n        {\r\n            \/\/ listView1_DragOver\u30a4\u30d9\u30f3\u30c8\u306b\u3066\u51e6\u7406\r\n        }\r\n\r\n        \/\/ \u2462\u30a2\u30a4\u30c6\u30e0\u30c9\u30e9\u30c3\u30b0\u4e2d\u306b\u7e70\u308a\u8fd4\u3057\u767a\u751f\u3059\u308b\u30a4\u30d9\u30f3\u30c8\r\n        \/\/ InsertionMark\uff08\u633f\u5165\u4f4d\u7f6e\uff09\u3092\u5165\u308c\u308b\r\n        private void listView1_DragOver(object sender, System.Windows.Forms.DragEventArgs e)\r\n        {\r\n            if (e.Data.GetDataPresent(typeof(ListViewItem)))\r\n            {\r\n                if ((e.KeyState &amp; 0x1) &gt; 0 &amp;&amp; (e.KeyState &amp; 0x8) &gt; 0)\r\n                {   \/\/ 0x1(1):\uff8f\uff73\uff7d\u5de6\uff0c0x2(2):\uff8f\uff73\uff7d\u53f3,0x4(4):Shift,0x8(8):CTRL,0x10(16):\uff8f\uff73\uff7d\u4e2d\u592e,0x20(32):ALT\r\n                    \/\/ \uff8f\uff73\uff7d\u5de6\uff0bCTRL\r\n                    e.Effect = DragDropEffects.Copy;\r\n                }\r\n                else\r\n                {\r\n                    e.Effect = DragDropEffects.Move;\r\n                }\r\n\r\n                \/\/ Retrieve the client coordinates of the mouse pointer.\r\n                Point targetPoint = listView1.PointToClient(new Point(e.X, e.Y));\r\n\r\n                \/\/ Retrieve the index of the item closest to the mouse pointer.\r\n                int targetIndex = listView1.InsertionMark.NearestIndex(targetPoint);\r\n                int ins_p_Index = targetIndex;                              \/\/ \u4e2d\u9593\u4f4d\u7f6e\r\n\r\n                \/\/ \u2605\u4e0b\u8a18\u306f\u78ba\u8a8d\u30fb\u691c\u8a3c\u7528(\u30a2\u30a4\u30c6\u30e0\u30d7\u30ed\u30d1\u30c6\u30a3\u53d6\u5f97\u306e\u53c2\u8003\u306b\u306a\u308b\u306e\u3067\u6b8b\u3057\u3066\u3044\u308b)\r\n                \/\/ListViewItem srcItem = (ListViewItem)e.Data.GetData(typeof(ListViewItem));\r\n                \/\/ListViewItem tgtItem = this.listView1.GetItemAt(targetPoint.X, targetPoint.Y);\r\n                \/\/textBox3.Text = srcItem.Index.ToString() + \" , \" + srcItem.Text + \" , \" + srcItem.ImageIndex.ToString() + \" , \" + srcItem.ImageKey;\r\n                \/\/if (tgtItem != null)\r\n                \/\/{ textBox4.Text = tgtItem.Index.ToString() + \" , \" + tgtItem.Text + \" , \" + tgtItem.ImageIndex.ToString() + \" , \" + tgtItem.ImageKey; }\r\n                \/\/else{ textBox4.Text = \"\"; }\r\n                \r\n                \r\n                \/\/ Confirm that the mouse pointer is not over the dragged item.\r\n                \/\/ \u6700\u8fd1\u30a2\u30a4\u30c6\u30e0\u304c\u3001\u73fe\u30c9\u30e9\u30c3\u30b0\u9805\u76ee\uff08\u81ea\u5206\u81ea\u8eab\uff09\u306e\u5834\u5408\u306f\u3001-1 \u304c\u8fd4\u3055\u308c\u308b\u3002\r\n                if (targetIndex &gt; -1)\r\n                {\r\n                    \/\/ Determine whether the mouse pointer is to the left or the right of \r\n                    \/\/ the midpoint of the closest item and set the InsertionMark.AppearsAfterItem property accordingly.\r\n                    Rectangle itemBounds = listView1.GetItemRect(targetIndex);\r\n                    if (targetPoint.X &gt; itemBounds.Left + (itemBounds.Width \/ 2))\r\n                    {\r\n                        listView1.InsertionMark.AppearsAfterItem = true;    \/\/ \u8fd1\u3044\u30a2\u30a4\u30c6\u30e0\u5f8c\u65b9\r\n                        ins_p_Index++;                                      \/\/ \u4e2d\u9593\u4f4d\u7f6e\r\n                    }\r\n                    else\r\n                    {\r\n                        listView1.InsertionMark.AppearsAfterItem = false;   \/\/ \u8fd1\u3044\u30a2\u30a4\u30c6\u30e0\u524d\u65b9\r\n                    }\r\n                }\r\n\r\n                \/\/ Set the location of the insertion mark. If the mouse is over the dragged item, \r\n                \/\/ the targetIndex value is -1 and the insertion mark disappears.\r\n                listView1.InsertionMark.Index = targetIndex;\r\n\r\n                textBox1.Text = targetIndex.ToString();                     \/\/ \u79fb\u52d5\u4f4d\u7f6e\r\n                textBox2.Text = ins_p_Index.ToString();                     \/\/ \u4e2d\u9593\u4f4d\u7f6e\r\n            } else {\r\n                textBox1.Text = \"ERR : Not List View Item.\";\r\n            }\r\n        }\r\n\r\n        \/\/ \u2463\u30c9\u30ed\u30c3\u30d7\u6642\uff11\u56de\u767a\u751f\u3059\u308b\u30a4\u30d9\u30f3\u30c8\r\n        private void listView1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)\r\n        {\r\n            if (e.Data.GetDataPresent(typeof(ListViewItem)))\r\n            {\r\n                \/\/ Retrieve the client coordinates of the mouse pointer.\r\n                Point targetPoint = listView1.PointToClient(new Point(e.X, e.Y));\r\n\r\n                \/\/ Retrieve the index of the item closest to the mouse pointer.\r\n                \/\/ ListViewItem tgtItem = this.listView1.GetItemAt(targetPoint.X, targetPoint.Y);   \/\/ \u56f3\u4e0a\u30dd\u30a4\u30f3\u30c8\u6642\u6709\u52b9\r\n                \/\/ int targetIndex = this.listView1.Items.IndexOf(tgtItem);                         \/\/ \u2192\u56f3\u306e\u9699\u9593\u306f\u7121\u52b9\r\n                int targetIndex = listView1.InsertionMark.NearestIndex(targetPoint);                \/\/ \u8fd1\u3044\u4f4d\u7f6e\r\n                int ins_p_Index = targetIndex;                                                      \/\/ \u4e2d\u9593\u4f4d\u7f6e\r\n                \r\n                ListViewItem srcItem = (ListViewItem)e.Data.GetData(typeof(ListViewItem));\r\n\r\n\r\n                if (targetIndex &gt; -1)\r\n                {\r\n                    \/\/ Determine whether the mouse pointer is to the left or the right of \r\n                    \/\/ the midpoint of the closest item and set the InsertionMark.AppearsAfterItem property accordingly.\r\n                    Rectangle itemBounds = listView1.GetItemRect(targetIndex);\r\n                    if (targetPoint.X &gt; itemBounds.Left + (itemBounds.Width \/ 2))\r\n                    {\r\n                        ins_p_Index++;                                                              \/\/ \u4e2d\u9593\u4f4d\u7f6e\r\n                    }\r\n\r\n                    listBox2.Items.Clear();\r\n                    int item_cnt = listView1.SelectedItems.Count;                                   \/\/ \u9078\u629e\u753b\u50cf\u6570\r\n                    \r\n                    if (item_cnt &gt; 1) {\r\n                        ListViewItem[] item_selected = new ListViewItem[listView1.SelectedItems.Count];\r\n\r\n                        \/\/ \u9078\u629e\u9805\u76ee\u3092\u4e00\u65e6\u914d\u5217\u306b\u683c\u7d0d\r\n                        for (int i = 0; i &lt; listView1.SelectedItems.Count; i++)\r\n                        {\r\n                            item_selected[i] = listView1.SelectedItems[i];\r\n                            string[] dat_vw1 = new string[4];\r\n\r\n                            dat_vw1[0] = item_selected[i].Index.ToString();\r\n                            dat_vw1[1] = item_selected[i].Text;\r\n                            dat_vw1[2] = item_selected[i].ImageIndex.ToString();\r\n                            dat_vw1[3] = item_selected[i].ImageKey;\r\n\r\n                            listBox2.Items.Add(dat_vw1[0] + \"  ,  \" + dat_vw1[1] + \"  ,  \" + dat_vw1[2] + \"  ,  \" + dat_vw1[3]);\r\n                        }\r\n\r\n                        \/\/ \u914d\u5217\u306b\u683c\u7d0d\u3057\u305f\u9078\u629e\u9805\u76ee\u3092\u9806\u756a\u306b\u8ffd\u52a0\r\n                        for (int i = 0; i &lt; item_selected.Length; i++)\r\n                        {   \r\n                            int exec_order = item_selected.Length - i - 1;          \/\/ \u8ffd\u52a0\u9806\u756a\u3092\u9006\u8ee2\u3057\u633f\u5165\u3059\u308b\r\n                            \r\n                            ListViewItem newItem = this.listView1.Items.Insert(ins_p_Index, item_selected[exec_order].Text, item_selected[exec_order].ImageIndex);\r\n                            newItem.Selected = true;\r\n                        }\r\n\r\n                        \/\/ \u79fb\u52d5\uff08Move\uff09\u6642\u30bd\u30fc\u30b9\u30a2\u30a4\u30c6\u30e0\u524a\u9664\r\n                        if ((e.KeyState &amp; 0x8) &lt;= 0)\r\n                        {\r\n                            for (int i = 0; i &lt; item_selected.Length; i++)\r\n                            {\r\n                                this.listView1.Items.Remove(item_selected[i]);\r\n                            }\r\n                        }\r\n\r\n\r\n                    } else { \r\n                        \/\/ \u78ba\u5b9a\u4f4d\u7f6e\u306b\u633f\u5165\r\n                        ListViewItem newItem = this.listView1.Items.Insert(ins_p_Index, srcItem.Text, srcItem.ImageIndex);\r\n                        newItem.Selected = true;\r\n\r\n                        \/\/ \u79fb\u52d5\u6642\u30bd\u30fc\u30b9\u30a2\u30a4\u30c6\u30e0\u524a\u9664\r\n                        if ((e.KeyState &amp; 0x8) &lt;= 0)\r\n                        {\r\n                            this.listView1.Items.Remove(srcItem);\r\n                        }\r\n                    }\r\n                        \r\n                    chk_listView1(1);                                                               \/\/ \u518d\u63cf\u753b                                       \r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        \/\/ \u30b5\u30e0\u30cd\u30a4\u30eb\u753b\u50cf\u53d6\u5f97\u30fblistView\u8868\u793a\r\n        private void get_pic_thumbnail()\r\n        {\r\n            string imageDir = @\"\"; \/\/ \u753b\u50cf\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\r\n            string[] jpgFiles = System.IO.Directory.GetFiles(imageDir, \"*.PNG\");\r\n\r\n            int width = 80;\r\n            int height = 80;\r\n\r\n            imageList1.ImageSize = new Size(width, height);\r\n\r\n            \/\/ imageList , listView \u767b\u9332\r\n            for (int i = 0; i &lt; jpgFiles.Length; i++)\r\n            {\r\n                String F_Name = Path.GetFileName(jpgFiles[i]);\r\n                Image original = Bitmap.FromFile(jpgFiles[i]);\r\n                Image thumbnail = createThumbnail(original, width, height);\r\n\r\n                imageList1.Images.Add(F_Name, thumbnail);\r\n                \/\/imageList1.Images.Add(thumbnail);\r\n                listView1.Items.Add(F_Name, i);\r\n              \r\n\r\n                original.Dispose();\r\n                thumbnail.Dispose();\r\n            } \r\n        }\r\n\r\n\r\n        \/\/ \u5e45w\u3001\u9ad8\u3055h \u30b5\u30e0\u30cd\u30a4\u30eb\u753b\u50cf\u4f5c\u6210\r\n        Image createThumbnail(Image image, int w, int h)\r\n        {\r\n            Bitmap canvas = new Bitmap(w, h);\r\n\r\n            Graphics g = Graphics.FromImage(canvas);\r\n            g.FillRectangle(new SolidBrush(Color.White), 0, 0, w, h);\r\n\r\n            float fw = (float)w \/ (float)image.Width;\r\n            float fh = (float)h \/ (float)image.Height;\r\n\r\n            float scale = Math.Min(fw, fh);\r\n            fw = image.Width * scale;\r\n            fh = image.Height * scale;\r\n\r\n            g.DrawImage(image, (w - fw) \/ 2, (h - fh) \/ 2, fw, fh);\r\n            g.Dispose();\r\n\r\n            return canvas;\r\n        }\r\n\r\n\r\n        \/\/ \u30a2\u30a4\u30c6\u30e0\u306e\u95a2\u9023\u30d7\u30ed\u30d1\u30c6\u30a3\u53d6\u5f97\u30fb\u518d\u8868\u793a\r\n        private void chk_listView1(int kbn)\r\n        {\r\n            listBox1.Items.Clear();\r\n            \/\/ \u30ea\u30b9\u30c8\u30d3\u30e5\u30fc\uff11(listView1)\u30d7\u30ed\u30d1\u30c6\u30a3\r\n            int listViewCnt1 = listView1.Items.Count;\r\n            string[,] dat_vw1 = new string[listViewCnt1, 4];\r\n            for (int i = 0; i &lt; listViewCnt1; i++)\r\n            {\r\n                dat_vw1[i, 0] = listView1.Items[i].Index.ToString();\r\n                dat_vw1[i, 1] = listView1.Items[i].Text;\r\n                dat_vw1[i, 2] = listView1.Items[i].ImageIndex.ToString();\r\n                dat_vw1[i, 3] = listView1.Items[i].ImageKey;\r\n\r\n                listBox1.Items.Add(dat_vw1[i, 0] + \"  ,  \" + dat_vw1[i, 1] + \"  ,  \" + dat_vw1[i, 2] + \"  ,  \" + dat_vw1[i, 3]);\r\n            }\r\n\r\n            \/\/ listView\u3092\u4e00\u65e6\u521d\u671f\u5316\u3057\u518d\u8868\u793a\u3059\u308b\r\n            if (kbn == 1)\r\n            {\r\n                listView1.Clear();\r\n\r\n                for (int i = 0; i &lt; dat_vw1.GetLength(0); i++)\r\n                {\r\n                    listView1.Items.Add(dat_vw1[i, 1], int.Parse(dat_vw1[i, 2]));\r\n                }\r\n            }\r\n        }\r\n\r\n        \/\/ \u518d\u8aad\u8fbc\r\n        private void button2_Click(object sender, EventArgs e)\r\n        {\r\n            listView1.Items.Clear();\r\n            imageList1.Images.Clear();\r\n            get_pic_thumbnail();\r\n            chk_listView1(0);\r\n        }\r\n\r\n        \/\/ \u62b9\u6d88\u51e6\u7406\uff08\u8907\u6570\u51e6\u7406\u53ef\u80fd\uff09\r\n        private void button1_Click(object sender, EventArgs e)\r\n        {\r\n            listBox2.Items.Clear();\r\n            if (listView1.SelectedItems.Count==0) { return; }       \/\/ \u9078\u629e\u9805\u76ee\u304c\u306a\u3044\u5834\u5408\u3001\u51e6\u7406\u7d42\u4e86\r\n\r\n            ListViewItem[] item_selected = new ListViewItem[listView1.SelectedItems.Count];\r\n\r\n            \/\/ \u9078\u629e\u9805\u76ee\u3092\u4e00\u65e6\u914d\u5217\u306b\u683c\u7d0d\r\n            for (int i = 0; i &lt; listView1.SelectedItems.Count; i++)\r\n            {\r\n                item_selected[i] = listView1.SelectedItems[i];\r\n                string[] dat_vw1 = new string[4];\r\n\r\n                dat_vw1[0] = item_selected[i].Index.ToString();\r\n                dat_vw1[1] = item_selected[i].Text;\r\n                dat_vw1[2] = item_selected[i].ImageIndex.ToString();\r\n                dat_vw1[3] = item_selected[i].ImageKey;\r\n\r\n                listBox2.Items.Add(dat_vw1[0] + \"  ,  \" + dat_vw1[1] + \"  ,  \" + dat_vw1[2] + \"  ,  \" + dat_vw1[3]);\r\n            }\r\n\r\n            \/\/ \u914d\u5217\u306b\u683c\u7d0d\u3057\u305f\u9078\u629e\u9805\u76ee\u3092\u9806\u756a\u306b\u62b9\u6d88\r\n            for (int i = 0; i &lt; item_selected.Length ; i++)\r\n            {\r\n                listView1.Items.Remove(item_selected[i]);\r\n            }\r\n        }\r\n\r\n       \r\n    }\r\n}<\/pre>\n<p><span style=\"font-size: 14pt;\">\u3000<\/span><\/p>\n<table style=\"width: 100%; border-collapse: collapse; border-style: none; height: 27px;\" border=\"1\">\n<tbody>\n<tr style=\"height: 30px; border-bottom: 3px #0000ff solid;\">\n<td style=\"width: 1.5%; border-style: none; background-color: #0000ff; height: 27px;\"><\/td>\n<td style=\"width: 2.63291%; border-style: none; height: 27px; background-color: #ffffff;\"><\/td>\n<td style=\"border-style: none; height: 27px; background-color: #ffffff; width: 96.2025%;\"><span style=\"font-family: verdana, geneva, sans-serif;\"><strong><span style=\"font-size: 18pt; color: #0000ff;\">\u53c2\u8003\u30b5\u30a4\u30c8<\/span><\/strong><\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-size: 12pt;\"><br \/>\n\u2460<a href=\"https:\/\/docs.microsoft.com\/ja-jp\/dotnet\/api\/system.windows.forms.listviewinsertionmark.nearestindex?view=netframework-4.8\">ListViewInsertionMark.NearestIndex(Point) \u30e1\u30bd\u30c3\u30c9<\/a><br \/>\n\u2461<a href=\"https:\/\/docs.microsoft.com\/ja-jp\/dotnet\/framework\/winforms\/controls\/how-to-display-an-insertion-mark-in-a-windows-forms-listview-control\">Windows \u30d5\u30a9\u30fc\u30e0 ListView \u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306b\u633f\u5165\u30de\u30fc\u30af\u8868\u793a<\/a><br \/>\n\u2462<a href=\"https:\/\/docs.microsoft.com\/ja-jp\/dotnet\/api\/system.windows.forms.drageventargs.keystate?view=netframework-4.8\">DragEventArgs.KeyState \u30d7\u30ed\u30d1\u30c6\u30a3<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; C# listView\u00a0 \u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7 \u3000\u5148\u56de listView \u3068 imageList \u3092\u4f7f\u3063\u3066\u30b5\u30e0\u30cd\u30a4\u30eb\u753b\u50cf\u8868\u793a\u30fb\u8ffd\u52a0\u30fb\u633f\u5165\u30fb\u524a\u9664\u306a\u3069\u306e\u57fa\u672c\u6a5f\u80fd\u3092\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002\u4eca\u56de\u306f listView \u306b\u8868\u793a\u3057\u305f &hellip; <a href=\"https:\/\/kats-eye.net\/info\/2020\/02\/12\/c-list%e2%80%90image-03\/\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">C# ListView  \u30de\u30a6\u30b9\u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u64cd\u4f5c<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":3080,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[75],"tags":[80,82,81],"_links":{"self":[{"href":"https:\/\/kats-eye.net\/info\/wp-json\/wp\/v2\/posts\/3073"}],"collection":[{"href":"https:\/\/kats-eye.net\/info\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kats-eye.net\/info\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kats-eye.net\/info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kats-eye.net\/info\/wp-json\/wp\/v2\/comments?post=3073"}],"version-history":[{"count":38,"href":"https:\/\/kats-eye.net\/info\/wp-json\/wp\/v2\/posts\/3073\/revisions"}],"predecessor-version":[{"id":3121,"href":"https:\/\/kats-eye.net\/info\/wp-json\/wp\/v2\/posts\/3073\/revisions\/3121"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kats-eye.net\/info\/wp-json\/wp\/v2\/media\/3080"}],"wp:attachment":[{"href":"https:\/\/kats-eye.net\/info\/wp-json\/wp\/v2\/media?parent=3073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kats-eye.net\/info\/wp-json\/wp\/v2\/categories?post=3073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kats-eye.net\/info\/wp-json\/wp\/v2\/tags?post=3073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}