下面是按下某个键时要执行的事件处理程序('输入')。无论我在哪里提到声明' p.tag_label.Visibilty = true"在代码中,它从不显示tag_label控件。请指导。我在代码中提到了tag_label确实失去了它的可见性。
void tag_box_KeyPress(object sender, KeyPressEventArgs e)
{
int i = (sender as TextBox).TabIndex;
if (e.KeyChar == (char)13)
{
foreach (var h in heading_wise)
{
foreach (var p in h.project_panels)
{
if (p.tag_box.TabIndex==i)
{
p.tag_text = p.tag_box.Text;
p.tag_box.Visible = false;
// p.tag_label.Visible = true;
if (!string.IsNullOrWhiteSpace(p.tag_box.Text))
{
p.tag_label.Text = p.tag_box.Text;
p.tag_label.Visible = true;
foreach (Label l in flowLayoutPanel1.Controls)
{
if (l.Text==p.tag_label.Text)
{
continue;
}
else
{
flowLayoutPanel1.Controls.Add(p.tag_label);
// Somewhere here the tag_label loses its visibilty automatically.
}
}
}
}
}
}
}
}