I have MDI form Application, This application contains a menuStrip.
The menuStrip contains Save & save as.

What I want is, if there is an open file(MDI child) the save & save as will be enable, otherwise disable.
Note: I haven't any code to do that because I don't know where can I write the code.

Now, How I can write the code? and where ?

有帮助吗?

解决方案

on create child window,

 var newChild = new Form() { MdiParent = this };
 menuItem.Enabled = true;
 newChild.FormClosing += (s, o) => menuItem.Enabled = (this.MdiChildren.Length  == 1) ? false : true;
 newChild.Show();
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top