質問編集履歴

1

コード書きました

2020/04/17 01:57

投稿

nakatasu
nakatasu

スコア4

test CHANGED
File without changes
test CHANGED
@@ -12,4 +12,168 @@
12
12
 
13
13
  どんな風にやれば良いですか? 
14
14
 
15
- ラベルは18個使います。
15
+ ラベルは12個使います。
16
+
17
+ ```C#
18
+
19
+
20
+
21
+ namespace ルーレット
22
+
23
+ {
24
+
25
+ public partial class Form1 : Form
26
+
27
+ {
28
+
29
+ public Form1()
30
+
31
+ {
32
+
33
+ InitializeComponent();
34
+
35
+ }
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+ private DateTime countTimer = DateTime.Parse("00:00:00");
48
+
49
+ private System.Windows.Forms.Label[] rlabel;
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+ private void timer1_Tick(object sender, EventArgs e)
58
+
59
+
60
+
61
+ {
62
+
63
+
64
+
65
+ this.rlabel = new System.Windows.Forms.Label[12];
66
+
67
+ rlabel[0] = this.label1;
68
+
69
+ rlabel[1] = this.label2;
70
+
71
+ rlabel[2] = this.label3;
72
+
73
+ rlabel[3] = this.label4;
74
+
75
+ rlabel[4] = this.label5;
76
+
77
+ rlabel[5] = this.label6;
78
+
79
+ rlabel[6] = this.label7;
80
+
81
+ rlabel[7] = this.label8;
82
+
83
+ rlabel[8] = this.label9;
84
+
85
+ rlabel[9] = this.label10;
86
+
87
+ rlabel[10] = this.label11;
88
+
89
+ rlabel[11] = this.label12;
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ for (int i = 0; i < 12; i++) {
98
+
99
+ if (i == 0)
100
+
101
+ {
102
+
103
+ rlabel[0].BackColor = Color.White;
104
+
105
+ rlabel[11].BackColor = Color.Black;
106
+
107
+ } else
108
+
109
+ {
110
+
111
+ rlabel[i].BackColor = Color.White;
112
+
113
+ rlabel[i - 1].BackColor = Color.Black;
114
+
115
+ }
116
+
117
+
118
+
119
+ }
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+ }
128
+
129
+
130
+
131
+ private void button_start_Click(object sender, EventArgs e)
132
+
133
+ {
134
+
135
+ this.timer1.Enabled = true;
136
+
137
+ this.button_start.Visible = false;
138
+
139
+ this.button_stop.Visible = true;
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+ }
148
+
149
+
150
+
151
+ private void button_stop_Click(object sender, EventArgs e)
152
+
153
+ {
154
+
155
+ this.timer1.Enabled = false;
156
+
157
+ this.button_start.Visible = true;
158
+
159
+ this.button_stop.Visible = false;
160
+
161
+ }
162
+
163
+
164
+
165
+ private void Form1_Load(object sender, EventArgs e)
166
+
167
+ {
168
+
169
+
170
+
171
+ }
172
+
173
+ }
174
+
175
+ }
176
+
177
+
178
+
179
+ ```