Sta*_*upt -3 c# winforms monogame
我一直在到处寻找,但没有找到在子窗体打开时禁用主窗体的代码(我可能只是措辞错误。就像当您打开文件时,如果您尝试单击应用程序打开闪光灯并发出声音。
当我处于非主要形式的第二种形式时,如何禁用应用程序?
编辑:所以这就是放置它的地方,因为每个人都在问
private void newToolStripMenuItem_Click(object sender, EventArgs e)
{
New_File newFile = new New_File();
if (newFile.ShowDialog() == DialogResult.OK)
{
}
}
Run Code Online (Sandbox Code Playgroud)
编辑 2:花费 16 秒打开文件,如下所示:
既然你拿走了我所有的代表,我必须发布一个链接http://puu.sh/aDBF4/9d7fd31926.png
我仍然不明白为什么当我不知道 ShowDialog 是什么的时候你们仍然对我投反对票。
如果您想在主窗体可见但处于禁用模式时显示子窗体,只需按照以下代码操作:
subForm.ShowDialog(); //Shows both main and sub form , but the main form is not accessible .
Run Code Online (Sandbox Code Playgroud)
但如果您想隐藏主表单,请按照以下示例操作:
this.Hide(); //Hides the main form.
subForm.ShowDialog(); //Shows the sub form.
this.Show(); //Shows the main form again after closing the sub form.
Run Code Online (Sandbox Code Playgroud)