我认为这本来是一个法律声明,但显然不是我如何隐藏或取消隐藏基于此的表单?
TrainingEventAddTraineesSearchForm searchform = new TrainingEventAddTraineesSearchForm(context);
if (searchform == null)
searchform.ShowDialog();
else
searchform.Visible = true;
Run Code Online (Sandbox Code Playgroud)
要显示或隐藏Windows窗体,可以使用Show()或Hide()方法,如下所示:searchform.Show();或searchform.Hide();
您可能需要考虑以下代码:
TrainingEventAddTraineesSearchForm searchform = new TrainingEventAddTraineesSearchForm(context);
if (searchform.Visible == false)
{ searchform.Show(); }
else
{ searchform.Hide(); }
Run Code Online (Sandbox Code Playgroud)