コード例 #1
0
 public static DevExpress.XtraBars.BarSubItem AddSubMenuToMenuItem(DevExpress.XtraBars.BarSubItem menuItem, List <STModulesInfo> modules)
 {
     if (modules != null)
     {
         foreach (STModulesInfo module in modules)
         {
             DevExpress.XtraBars.BarButtonItem subItem = new DevExpress.XtraBars.BarButtonItem();
             subItem.Caption    = module.STModuleDesc;
             subItem.Tag        = module.STModuleName;
             subItem.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(BarButtonItem_ItemClick);
             menuItem.AddItem(subItem);
         }
     }
     return(menuItem);
 }
コード例 #2
0
ファイル: frmEditContract.cs プロジェクト: GDuggi/DemoTest
        private void InitPopupMenu()
        {
            try
            {
                string    categoryLabel = "";
                ArrayList categoryList  = new ArrayList();
                //Load up an array list for unique, non-blank iterating
                foreach (DataRow row in clauseHeaderTable.Rows)
                {
                    categoryLabel = row["Category"].ToString();
                    if (categoryList.IndexOf(categoryLabel) == -1 &&
                        categoryLabel.Trim().Length > 0)
                    {
                        categoryList.Add(categoryLabel);
                    }
                }

                categoryList.Sort();
                BarManager bManager  = new BarManager();
                string     filterStr = "";
                //For each item in array list, select all items
                for (int i = 0; i < categoryList.Count; i++)
                {
                    categoryLabel = categoryList[i].ToString();
                    DevExpress.XtraBars.BarSubItem barSubItem = new DevExpress.XtraBars.BarSubItem(bManager, categoryLabel);

                    filterStr = "Category = '" + categoryLabel + "'";
                    foreach (DataRow row in clauseHeaderTable.Select(filterStr))
                    {
                        BarItem item = new BarButtonItem();
                        item.Caption    = row["ShortName"].ToString();
                        item.Tag        = (int)row["PrmntConfirmClauseId"];
                        item.ItemClick += ClauseBtnClick;
                        barSubItem.AddItem(item);
                    }
                    pmenuEditContract.AddItem(barSubItem);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("An error occurred while setting up the popup menu data." + Environment.NewLine +
                                    "Error CNF-225 in " + FORM_NAME + ".InitPopupMenu(): " + ex.Message);
            }
        }
コード例 #3
0
        /// <summary>
        /// 注册近期访问窗口--在窗口打开事件中调用
        /// </summary>
        /// <param name="as_Caption">窗口显示的文本</param>
        /// <param name="as_Tag">打开的Form名</param>
        /// <param name="as_ImageIndex">Ribbon上显示的图标名称</param>
        void RegeditMenu(IOpenModuleForm IOpenForm)
        {
            DevExpress.XtraBars.BarSubItem barOld = MainFormMDI.OldBarSubItem;

            //最近访问的菜单只存储4条,多的将以前的删除掉加入新的
            if (barOld.ItemLinks.Count > 3)
            {
                int mod = barOld.ItemLinks.Count % 4;
                barOld.ItemLinks.Remove(barOld.ItemLinks[mod]);
            }

            //添加新的菜单
            BarButtonItem btnitem = new BarButtonItem();

            btnitem.Name       = IOpenForm.FormName;
            btnitem.Caption    = IOpenForm.FormText;
            btnitem.Tag        = IOpenForm.FormTag;
            btnitem.LargeGlyph = IOpenForm.FormImage32;
            barOld.AddItem(btnitem);
            btnitem.ItemClick += new ItemClickEventHandler(btnitem_ItemClick);
        }
コード例 #4
0
      private void InitPopupMenu()
      {
         try
         {
            string categoryLabel = "";
            ArrayList categoryList = new ArrayList();
            //Load up an array list for unique, non-blank iterating
            foreach (DataRow row in clauseHeaderTable.Rows)
            {
               categoryLabel = row["Category"].ToString();
               if (categoryList.IndexOf(categoryLabel) == -1 &&
                   categoryLabel.Trim().Length > 0)
                  categoryList.Add(categoryLabel);
            }

            categoryList.Sort();
            BarManager bManager = new BarManager();
            string filterStr = "";
            //For each item in array list, select all items
            for (int i = 0; i < categoryList.Count; i++)
            {
               categoryLabel = categoryList[i].ToString();
               DevExpress.XtraBars.BarSubItem barSubItem = new DevExpress.XtraBars.BarSubItem(bManager, categoryLabel);
                
               filterStr = "Category = '" + categoryLabel + "'";
               foreach (DataRow row in clauseHeaderTable.Select(filterStr))
               {
                  BarItem item = new BarButtonItem();
                  item.Caption = row["ShortName"].ToString();
                  item.Tag = (int)row["PrmntConfirmClauseId"];
                  item.ItemClick += ClauseBtnClick;
                  barSubItem.AddItem(item);
               }
               pmenuEditContract.AddItem(barSubItem);
            }
         }
         catch (Exception ex)
         {
            throw new Exception("An error occurred while setting up the popup menu data." + Environment.NewLine +
                 "Error CNF-225 in " + FORM_NAME + ".InitPopupMenu(): " + ex.Message);
         }
      }