回答編集履歴

1

追記

2019/04/03 14:13

投稿

YAmaGNZ
YAmaGNZ

スコア10258

test CHANGED
@@ -1,3 +1,63 @@
1
1
  LabelのAutoSizeプロパティは初期値でtrueだったかと思います。
2
2
 
3
3
  Textプロパティを設定していないので、見えないだけじゃないですか?
4
+
5
+
6
+
7
+ ```C#
8
+
9
+ RadioButton[] radiobutton = new RadioButton[6];
10
+
11
+ Label[] label = new Label[7];
12
+
13
+ private void Form1_Load(object sender, EventArgs e)
14
+
15
+ {
16
+
17
+ int i;
18
+
19
+ for (i = 0; i < 6; i++)
20
+
21
+ {
22
+
23
+ radiobutton[i] = new RadioButton();         //ラジオオブジェクトを作成する
24
+
25
+ radiobutton[i].Left = 0;               //左辺の座標を指定する
26
+
27
+ radiobutton[i].Top = radiobutton[0].Height * i;  //上辺の座標を指定する
28
+
29
+ radiobutton[i].Tag = i;               //Tagを指定する
30
+
31
+ Controls.Add(radiobutton[i]);            //コントロールを登録する
32
+
33
+ }
34
+
35
+
36
+
37
+ for (i = 0; i < 7; i++)
38
+
39
+ {
40
+
41
+ label[i] = new Label();               //ラベルオブジェクトを作成する
42
+
43
+ label[i].Left = radiobutton[0].Width;     //左辺の座標を指定する
44
+
45
+ label[i].Top = label[0].Height * i;        //上辺の座標を指定する
46
+
47
+ label[i].Tag = i;                  //Tagを指定する
48
+
49
+ label[i].Text = $"test{i}";
50
+
51
+ Controls.Add(label[i]);              //コントロールを登録する
52
+
53
+ }
54
+
55
+ }
56
+
57
+
58
+
59
+ ```
60
+
61
+ これでラベルが表示されているのを確認しています。
62
+
63
+ 元のソースから、Leftの値とTextプロパティを変えただけです。