01.
using
System;
02.
using
System.Drawing;
03.
using
System.Windows.Forms;
04.
05.
namespace
BuildField
06.
{
07.
public
partial
class
Form1 : Form
08.
{
09.
private
TextBox[] textBoxArray;
10.
11.
public
Form1()
12.
{
13.
InitializeComponent();
14.
controlInit();
15.
}
16.
17.
private
void
controlInit()
18.
{
19.
20.
int
fieldCount = 25;
21.
22.
textBoxArray =
new
TextBox[fieldCount];
23.
24.
for
(
int
i = 0; i < fieldCount; i++)
25.
{
26.
27.
this
.textBoxArray[i] =
new
TextBox();
28.
this
.textBoxArray[i].Location =
new
Point(144, 29 + i * 35);
29.
this
.textBoxArray[i].Name = $
"textBox{i}"
;
30.
this
.textBoxArray[i].Size =
new
Size(588, 19);
31.
this
.textBoxArray[i].TabIndex = i;
32.
this
.Controls.Add(
this
.textBoxArray[i]);
33.
34.
}
35.
36.
Console.WriteLine($
"フィールドを{fieldCount}個作成しました"
);
37.
}
38.
39.
}
40.
}