bool flag = true;
private void btnOK_Click(object sender, EventArgs e)
{
if (flag)
{
this.txtName.Text = "张三";
flag = false;
}
else
{
if (txtName.Visible)
{
this.txtName.Visible = false;
}
else
{
this.txtName.Visible = true;
}
}
}
单击时显示文本框的内容,再次点击button按钮时 text.box 框 变为隐藏。
温馨提示:答案为网友推荐,仅供参考