zoukankan      html  css  js  c++  java
  • C#遍历菜单项

    (1)横向遍历  ToolStripMenuItem

                foreach (ToolStripMenuItem con in this.MainMenuStrip.Items)
                {

                }

    (2)纵向遍历  ToolStripItem

                    foreach (ToolStripItem con2 in con.DropDownItems)
                    {
                        if (con2 is ToolStripMenuItem)
                            if (con2.Tag == "10")
                                con2.Enabled = false;   //使此项不能选

                            //con2.Visible= false;     //使此项不可用

                    }

    (3)先横后纵遍历

                foreach (ToolStripMenuItem con in this.MainMenuStrip.Items)
                {
                    foreach (ToolStripItem con2 in con.DropDownItems)
                    {
                        if (con2 is ToolStripMenuItem)
                            if (con2.Tag == "10")
                                con2.Enabled = false;  //使此项不能选

                         //con2.Visible= false;     //使此项不可用

                    }
                }

     如果能与数据库结合,就可以实现“角色”功能。例如,在系统中实现过。

    出处:https://blog.csdn.net/xiaozhao_19/article/details/5880989

  • 相关阅读:
    [HNOI2006]超级英雄
    [CTSC1999]家园
    火星探险问题
    [HNOI2008]GT考试
    [USACO14DEC]后卫马克Guard Mark
    [NOI2018]归程
    [USACO15DEC]最大流Max Flow
    [NOIPlus]斗地主
    [LUOGU] P3128 [USACO15DEC]最大流Max Flow
    [BZOJ] 1878: [SDOI2009]HH的项链
  • 原文地址:https://www.cnblogs.com/mq0036/p/10400535.html
Copyright © 2011-2022 走看看