質問編集履歴

3

見やすさ

2018/11/16 06:49

投稿

tomoyo1010
tomoyo1010

スコア24

test CHANGED
File without changes
test CHANGED
@@ -16,60 +16,58 @@
16
16
 
17
17
 
18
18
 
19
- ``` //複数選択した場合セルをコピー
19
+ //複数選択した場合セルをコピー
20
20
 
21
- ``` if (dgv.SelectedCells.Count > 1)
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
- ```
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
- ``` if (this.dgv.SelectedCells[dgv.SelectedCells.Count - 1].Value.ToString() != "")
59
+ {
62
60
 
63
- ``` {
61
+ if (this.dgv.SelectedCells[dgv.SelectedCells.Count - 1].Value.ToString() != "")
64
62
 
63
+ {
64
+
65
- ``` //dgv.RowCount - dgv.SelectedCells.Count - dgv.SelectedCells[dgv.SelectedCells.Count - 1].RowIndex == 0
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

見やすさ

2018/11/16 06:49

投稿

tomoyo1010
tomoyo1010

スコア24

test CHANGED
File without changes
test CHANGED
@@ -18,58 +18,58 @@
18
18
 
19
19
  ``` //複数選択した場合セルをコピー
20
20
 
21
- if (dgv.SelectedCells.Count > 1)
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
- for (int i = dgv.SelectedCells.Count - 2; i >= 0; i--)
59
+ ``` {
58
60
 
59
- {
61
+ ``` if (this.dgv.SelectedCells[dgv.SelectedCells.Count - 1].Value.ToString() != "")
60
62
 
61
- if (this.dgv.SelectedCells[dgv.SelectedCells.Count - 1].Value.ToString() != "")
63
+ ``` {
62
64
 
63
- {
64
-
65
- //dgv.RowCount - dgv.SelectedCells.Count - dgv.SelectedCells[dgv.SelectedCells.Count - 1].RowIndex == 0
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

現在のコードを追加

2018/11/16 06:48

投稿

tomoyo1010
tomoyo1010

スコア24

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
+ }```