using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
List<Label> labels = new List<Label>();
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_Shown(object sender, EventArgs e)
{
for (int i = 0; i < 100; i++)
{
//ラベルの動的作成
Label label = new Label();
//Nameの設定
label.Name = "label" + i.ToString();
label.Text = "label" + i.ToString();
//動的に作成したLabelの細かい設定をここで
label.AutoSize = true;
label.Location = new Point(10, (i + 1) * 10);
//自分で管理するリストに追加
//labels.Add(label);
//Form1の配下に追加
this.Controls.Add(label);
}
this.Invalidate();
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLkNvbXBvbmVudE1vZGVsOwp1c2luZyBTeXN0ZW0uRGF0YTsKdXNpbmcgU3lzdGVtLkRyYXdpbmc7CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uVGV4dDsKdXNpbmcgU3lzdGVtLldpbmRvd3MuRm9ybXM7CgpuYW1lc3BhY2UgV2luZG93c0Zvcm1zQXBwbGljYXRpb24xCnsKICAgIHB1YmxpYyBwYXJ0aWFsIGNsYXNzIEZvcm0xIDogRm9ybQogICAgewogICAgICAgIHB1YmxpYyBGb3JtMSgpCiAgICAgICAgewogICAgICAgICAgICBJbml0aWFsaXplQ29tcG9uZW50KCk7CiAgICAgICAgfQogICAgICAgIExpc3Q8TGFiZWw+IGxhYmVscyA9IG5ldyBMaXN0PExhYmVsPigpOwogICAgICAgIHByaXZhdGUgdm9pZCBGb3JtMV9Mb2FkKG9iamVjdCBzZW5kZXIsIEV2ZW50QXJncyBlKQogICAgICAgIHsKCiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHZvaWQgRm9ybTFfU2hvd24ob2JqZWN0IHNlbmRlciwgRXZlbnRBcmdzIGUpCiAgICAgICAgewogICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDEwMDsgaSsrKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAvL+ODqeODmeODq+OBruWLleeahOS9nOaIkAogICAgICAgICAgICAgICAgTGFiZWwgbGFiZWwgPSBuZXcgTGFiZWwoKTsKICAgICAgICAgICAgICAgIC8vTmFtZeOBruioreWumgogICAgICAgICAgICAgICAgbGFiZWwuTmFtZSA9ICJsYWJlbCIgKyBpLlRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICBsYWJlbC5UZXh0ID0gImxhYmVsIiArIGkuVG9TdHJpbmcoKTsKCiAgICAgICAgICAgICAgICAvL+WLleeahOOBq+S9nOaIkOOBl+OBn0xhYmVs44Gu57Sw44GL44GE6Kit5a6a44KS44GT44GT44GnCiAgICAgICAgICAgICAgICBsYWJlbC5BdXRvU2l6ZSA9IHRydWU7CiAgICAgICAgICAgICAgICBsYWJlbC5Mb2NhdGlvbiA9IG5ldyBQb2ludCgxMCwgKGkgKyAxKSAqIDEwKTsKCiAgICAgICAgICAgICAgICAvL+iHquWIhuOBp+euoeeQhuOBmeOCi+ODquOCueODiOOBq+i/veWKoAogICAgICAgICAgICAgICAgLy9sYWJlbHMuQWRkKGxhYmVsKTsKICAgICAgICAgICAgICAgIC8vRm9ybTHjga7phY3kuIvjgavov73liqAKICAgICAgICAgICAgICAgIHRoaXMuQ29udHJvbHMuQWRkKGxhYmVsKTsKICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLkludmFsaWRhdGUoKTsKICAgICAgICB9CiAgICB9Cn0K