首页上一页 1 下一页尾页 1 条记录 1/1页
C#实战开发宝典中的问题
发表在C#图书答疑
2010-07-20
是否精华
是
否
版块置顶:
是
否
#region 设置主窗体菜单不可用
/// <summary>
/// 设置主窗体菜单不可用.
/// </summary>
/// <param name="MenuS">MenuStrip控件</param>
public void MainMenuF(MenuStrip MenuS)
{
string Men = "";
for (int i = 0; i < MenuS.Items.Count; i++)
{
Men = ((ToolStripDropDownItem)MenuS.Items[i]).Name;
if (Men.IndexOf("Menu") == -1)
((ToolStripDropDownItem)MenuS.Items[i]).Enabled = false;
ToolStripDropDownItem newmenu = (ToolStripDropDownItem)MenuS.Items[i];
if (newmenu.HasDropDownItems && newmenu.DropDownItems.Count > 0)
for (int j = 0; j < newmenu.DropDownItems.Count; j++)
{
Men = newmenu.DropDownItems[j].Name;
if (Men.IndexOf("Menu") == -1)
newmenu.DropDownItems[j].Enabled = false;
ToolStripDropDownItem newmenu2 = (ToolStripDropDownItem)newmenu.DropDownItems[j];
if (newmenu2.HasDropDownItems && newmenu2.DropDownItems.Count > 0)
for (int p = 0; p < newmenu2.DropDownItems.Count; p++)
newmenu2.DropDownItems[p].Enabled = false;
}
}
}
#endregion
这段代码中
Men.IndexOf("Menu") == -1是表示什么意思啊
/// <summary>
/// 设置主窗体菜单不可用.
/// </summary>
/// <param name="MenuS">MenuStrip控件</param>
public void MainMenuF(MenuStrip MenuS)
{
string Men = "";
for (int i = 0; i < MenuS.Items.Count; i++)
{
Men = ((ToolStripDropDownItem)MenuS.Items[i]).Name;
if (Men.IndexOf("Menu") == -1)
((ToolStripDropDownItem)MenuS.Items[i]).Enabled = false;
ToolStripDropDownItem newmenu = (ToolStripDropDownItem)MenuS.Items[i];
if (newmenu.HasDropDownItems && newmenu.DropDownItems.Count > 0)
for (int j = 0; j < newmenu.DropDownItems.Count; j++)
{
Men = newmenu.DropDownItems[j].Name;
if (Men.IndexOf("Menu") == -1)
newmenu.DropDownItems[j].Enabled = false;
ToolStripDropDownItem newmenu2 = (ToolStripDropDownItem)newmenu.DropDownItems[j];
if (newmenu2.HasDropDownItems && newmenu2.DropDownItems.Count > 0)
for (int p = 0; p < newmenu2.DropDownItems.Count; p++)
newmenu2.DropDownItems[p].Enabled = false;
}
}
}
#endregion
这段代码中
Men.IndexOf("Menu") == -1是表示什么意思啊