当Child处于活动状态时,禁用MDI Parent

我在我的软件菜单条中,当用户点击时我想打开另一个子窗口,但我想禁用父窗口,这意味着只需关闭或点击kk使其再次可用。

我当前的代码打开表单但不会使父禁用

if (about == null) { about = new aboutForm(); about.ShowDialog(this); } 

我试过about.ShowDialog(); 它会引发错误

我感谢任何可能的代码解决方案

不需要条件因为ShowDialog(this)会显示modal dialog。

 aboutForm about = new aboutForm(); about.ShowDialog(this); 

在aboutForm中

 public partial class aboutForm: Form { public aboutForm() { InitializeComponent(); } private void aboutForm_Load(object sender, EventArgs e) { this.FormClosing +=new FormClosingEventHandler(aboutForm_FormClosing); } private void aboutForm_FormClosing(object sender, FormClosingEventArgs e) { this.DialogResult = DialogResult.OK; } }