禁用工具栏菜单

时间:2013-10-05 10:01:30

标签: winforms visual-c#-express-2010

我正在尝试对menustrip启用= false ..但代码正在执行,但无法禁用菜单

        MenuStrip ms = (MenuStrip)frm_MDI.objMdi.Controls["msMainMenu"];
        foreach (ToolStripMenuItem tmm in ms.Items)
        {
            tmm.Enabled = false;
        }

1 个答案:

答案 0 :(得分:0)

添加objMdi = this后;在加载事件。它工作正常。

    private void frm_MDI_Load_1(object sender, EventArgs e)
    {
        objMdi = this;
    }