質問編集履歴
3
見やすさ
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,60 +16,58 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
-
|
19
|
+
//複数選択した場合セルをコピー
|
20
20
|
|
21
|
-
|
21
|
+
if (dgv.SelectedCells.Count > 1)
|
22
22
|
|
23
|
-
|
23
|
+
{
|
24
24
|
|
25
|
-
|
25
|
+
//選択処理未完成
|
26
26
|
|
27
|
-
|
27
|
+
//if (dgv.RowCount - dgv.SelectedCells.Count - dgv.SelectedCells[dgv.SelectedCells.Count - 1].RowIndex <= 0)
|
28
28
|
|
29
|
-
|
29
|
+
//{
|
30
30
|
|
31
|
-
|
31
|
+
// cellenterflag = true;
|
32
32
|
|
33
|
-
|
33
|
+
// dataGridView1.AllowUserToAddRows = false;
|
34
34
|
|
35
|
-
|
35
|
+
//}
|
36
36
|
|
37
|
-
|
37
|
+
//if (cellenterflag)
|
38
38
|
|
39
|
-
|
39
|
+
//{
|
40
40
|
|
41
|
-
|
41
|
+
// shaderData.Tables[0].Rows.Add();
|
42
42
|
|
43
|
-
|
43
|
+
// //テーブルの更新を画面に反映
|
44
44
|
|
45
|
-
|
45
|
+
// dataGridView1.DataSource = shaderData;
|
46
46
|
|
47
|
-
|
47
|
+
// dataGridView1.DataMember = "Table1";
|
48
48
|
|
49
|
-
|
49
|
+
// cellenterflag = false;
|
50
50
|
|
51
|
-
|
51
|
+
// dataGridView1.AllowUserToAddRows = true;
|
52
52
|
|
53
|
-
|
53
|
+
//}
|
54
54
|
|
55
|
-
```
|
56
55
|
|
57
|
-
``` for (int i = dgv.SelectedCells.Count - 2; i >= 0; i--)
|
58
56
|
|
59
|
-
|
57
|
+
for (int i = dgv.SelectedCells.Count - 2; i >= 0; i--)
|
60
58
|
|
61
|
-
|
59
|
+
{
|
62
60
|
|
63
|
-
|
61
|
+
if (this.dgv.SelectedCells[dgv.SelectedCells.Count - 1].Value.ToString() != "")
|
64
62
|
|
63
|
+
{
|
64
|
+
|
65
|
-
|
65
|
+
//dgv.RowCount - dgv.SelectedCells.Count - dgv.SelectedCells[dgv.SelectedCells.Count - 1].RowIndex == 0
|
66
66
|
|
67
67
|
this.dgv.SelectedCells[i].Value = this.dgv.SelectedCells[dgv.SelectedCells.Count - 1].Value;//配列がセルの下から順で入ってる
|
68
68
|
|
69
|
-
|
69
|
+
}
|
70
70
|
|
71
|
-
|
71
|
+
}
|
72
72
|
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
}
|
2
見やすさ
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,58 +18,58 @@
|
|
18
18
|
|
19
19
|
``` //複数選択した場合セルをコピー
|
20
20
|
|
21
|
-
|
21
|
+
``` if (dgv.SelectedCells.Count > 1)
|
22
22
|
|
23
|
-
|
23
|
+
``` {
|
24
24
|
|
25
|
-
|
25
|
+
``` //選択処理未完成
|
26
26
|
|
27
|
-
//if (dgv.RowCount - dgv.SelectedCells.Count - dgv.SelectedCells[dgv.SelectedCells.Count - 1].RowIndex <= 0)
|
27
|
+
``` //if (dgv.RowCount - dgv.SelectedCells.Count - dgv.SelectedCells[dgv.SelectedCells.Count - 1].RowIndex <= 0)
|
28
28
|
|
29
|
-
//{
|
29
|
+
``` //{
|
30
30
|
|
31
|
-
// cellenterflag = true;
|
31
|
+
``` // cellenterflag = true;
|
32
32
|
|
33
|
-
// dataGridView1.AllowUserToAddRows = false;
|
33
|
+
``` // dataGridView1.AllowUserToAddRows = false;
|
34
34
|
|
35
|
-
//}
|
35
|
+
``` //}
|
36
36
|
|
37
|
-
//if (cellenterflag)
|
37
|
+
``` //if (cellenterflag)
|
38
38
|
|
39
|
-
//{
|
39
|
+
``` //{
|
40
40
|
|
41
|
-
// shaderData.Tables[0].Rows.Add();
|
41
|
+
``` // shaderData.Tables[0].Rows.Add();
|
42
42
|
|
43
|
-
// //テーブルの更新を画面に反映
|
43
|
+
``` // //テーブルの更新を画面に反映
|
44
44
|
|
45
|
-
// dataGridView1.DataSource = shaderData;
|
45
|
+
``` // dataGridView1.DataSource = shaderData;
|
46
46
|
|
47
|
-
// dataGridView1.DataMember = "Table1";
|
47
|
+
``` // dataGridView1.DataMember = "Table1";
|
48
48
|
|
49
|
-
// cellenterflag = false;
|
49
|
+
``` // cellenterflag = false;
|
50
50
|
|
51
|
-
// dataGridView1.AllowUserToAddRows = true;
|
51
|
+
``` // dataGridView1.AllowUserToAddRows = true;
|
52
52
|
|
53
|
-
//}
|
53
|
+
``` //}
|
54
54
|
|
55
|
+
```
|
55
56
|
|
57
|
+
``` for (int i = dgv.SelectedCells.Count - 2; i >= 0; i--)
|
56
58
|
|
57
|
-
|
59
|
+
``` {
|
58
60
|
|
59
|
-
|
61
|
+
``` if (this.dgv.SelectedCells[dgv.SelectedCells.Count - 1].Value.ToString() != "")
|
60
62
|
|
61
|
-
|
63
|
+
``` {
|
62
64
|
|
63
|
-
{
|
64
|
-
|
65
|
-
|
65
|
+
``` //dgv.RowCount - dgv.SelectedCells.Count - dgv.SelectedCells[dgv.SelectedCells.Count - 1].RowIndex == 0
|
66
66
|
|
67
67
|
this.dgv.SelectedCells[i].Value = this.dgv.SelectedCells[dgv.SelectedCells.Count - 1].Value;//配列がセルの下から順で入ってる
|
68
68
|
|
69
|
-
}
|
69
|
+
``` }
|
70
70
|
|
71
|
-
|
71
|
+
``` }
|
72
72
|
|
73
73
|
|
74
74
|
|
75
|
-
}```
|
75
|
+
``` }```
|
1
現在のコードを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -13,3 +13,63 @@
|
|
13
13
|
改善方法などがあればどちらの問題に対しての意見も教えていただきたいです。
|
14
14
|
|
15
15
|
よろしくお願いします。
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
``` //複数選択した場合セルをコピー
|
20
|
+
|
21
|
+
if (dgv.SelectedCells.Count > 1)
|
22
|
+
|
23
|
+
{
|
24
|
+
|
25
|
+
//選択処理未完成
|
26
|
+
|
27
|
+
//if (dgv.RowCount - dgv.SelectedCells.Count - dgv.SelectedCells[dgv.SelectedCells.Count - 1].RowIndex <= 0)
|
28
|
+
|
29
|
+
//{
|
30
|
+
|
31
|
+
// cellenterflag = true;
|
32
|
+
|
33
|
+
// dataGridView1.AllowUserToAddRows = false;
|
34
|
+
|
35
|
+
//}
|
36
|
+
|
37
|
+
//if (cellenterflag)
|
38
|
+
|
39
|
+
//{
|
40
|
+
|
41
|
+
// shaderData.Tables[0].Rows.Add();
|
42
|
+
|
43
|
+
// //テーブルの更新を画面に反映
|
44
|
+
|
45
|
+
// dataGridView1.DataSource = shaderData;
|
46
|
+
|
47
|
+
// dataGridView1.DataMember = "Table1";
|
48
|
+
|
49
|
+
// cellenterflag = false;
|
50
|
+
|
51
|
+
// dataGridView1.AllowUserToAddRows = true;
|
52
|
+
|
53
|
+
//}
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
for (int i = dgv.SelectedCells.Count - 2; i >= 0; i--)
|
58
|
+
|
59
|
+
{
|
60
|
+
|
61
|
+
if (this.dgv.SelectedCells[dgv.SelectedCells.Count - 1].Value.ToString() != "")
|
62
|
+
|
63
|
+
{
|
64
|
+
|
65
|
+
//dgv.RowCount - dgv.SelectedCells.Count - dgv.SelectedCells[dgv.SelectedCells.Count - 1].RowIndex == 0
|
66
|
+
|
67
|
+
this.dgv.SelectedCells[i].Value = this.dgv.SelectedCells[dgv.SelectedCells.Count - 1].Value;//配列がセルの下から順で入ってる
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
}```
|