我有一个表格,它是一个 MDI 容器。在该表单中,我生成 6 个子表单,每个子表单都有一个标签:
for (int i = 0; i < 6; i++)
{
Form window = new Form();
window.Width = 100;
window.Height = 100;
window.MdiParent = this;
window.FormBorderStyle = FormBorderStyle.FixedToolWindow;
Label label = new Label();
label.AutoSize = true;
label.Location = new System.Drawing.Point(1, 1);
label.Size = new System.Drawing.Size(35, 13);
label.TabIndex = 1;
label.Name = "label" + i.ToString();
label.Text = window.Top.ToString();
window.LocationChanged += new System.EventHandler(HERE);
window.Controls.Add(label);
window.Show();
}
我在 locationchanged for window 上添加了一个事件。现在怎么做才能使标签更新到窗口位置?