标签:nta mamicode _for r++ 更新 init code idt 设计
??我总要写点东西吧,不然感觉难道不是很无趣?(其实是没什么东西好写)那就记录一下Windows程序设计吧(`?ω?′)
?????
public Form2()
{
InitializeComponent();
Height = 300; Width = 500;
}
int counter = 0;
int total = 0;
private void Form2_Load(object sender, EventArgs e)
{
for (int i = 0; i < 6; i++) AddFrorm();
Text = "当前拥有的子窗口数为" + counter;
}
private void button1_Click(object sender, EventArgs e)
{
AddFrorm();
Text = "当前拥有的子窗口数为" + counter;
}
private void AddFrorm()
{
Form form = new Form();
form.Height = 80;
form.Width = 200;
form.FormBorderStyle = FormBorderStyle.FixedToolWindow;
form.Text = "子窗口" + ++total; counter++;
form.FormClosing += Form_FormClosing;
form.StartPosition = FormStartPosition.Manual;
form.Top = (total-1) / 3 * 100+Height+Top;
form.Left = (total-1) % 3 * 250 + Left;
form.Show();
}
private void Form_FormClosing(object sender, FormClosingEventArgs e)
{
Text = "当前拥有的子窗口数为" + --counter;
}
体验不是很好,可能是没写习惯,真香警告? = v =
标签:nta mamicode _for r++ 更新 init code idt 设计
原文地址:https://www.cnblogs.com/xxhao/p/12404961.html