當前位置: 首頁>>代碼示例>>C#>>正文


C# Forms.Menu類代碼示例

本文整理匯總了C#中System.Windows.Forms.Menu的典型用法代碼示例。如果您正苦於以下問題:C# Menu類的具體用法?C# Menu怎麽用?C# Menu使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Menu類屬於System.Windows.Forms命名空間,在下文中一共展示了Menu類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddBranchSpecificActions

 private void AddBranchSpecificActions(Menu.MenuItemCollection items, bool needsLeadingSeparator)
 {
     var selectedRows = branchGrid.Grid.SelectedRows;
     if (selectedRows.Count > 0)
     {
         if (needsLeadingSeparator)
         {
             items.AddSeparator();
         }
         var row = selectedRows[0].DataRow;
         var branchId = row["ID"];
         var taskId = row["TaskID"];
         var builtInActions = new[]
         {
             new MenuAction("defaultInspect", "&Inspect", true,
                         () => SetCurrentBranch(branchId, taskId) ),
             new MenuAction("defaultOpen", "&Work on this", row["BasePath"] != DBNull.Value,
                         () => StartWorkOnBranch(branchId, taskId) ),
         };
         items.AddActions(builtInActions);
         var specificActions = _sourceRepository.GetBranchActions(branchId);
         if (specificActions.Count > 0)
         {
             items.AddSeparator();
             items.AddActions(specificActions);
         }
     }
 }
開發者ID:olivierdagenais,項目名稱:branchreview,代碼行數:28,代碼來源:BranchBrowser.cs

示例2: AddTaskSpecificActions

 private void AddTaskSpecificActions(Menu.MenuItemCollection items, bool needsLeadingSeparator)
 {
     var taskId = taskGrid.FindSelectedId();
     if (taskId != null)
     {
         var specificActions = _taskRepository.GetTaskActions(taskId);
         if (specificActions.Count > 0)
         {
             if (needsLeadingSeparator)
             {
                 items.AddSeparator();
             }
             items.AddActions(specificActions);
         }
         if (_sourceRepository != null)
         {
             if (specificActions.Count > 0)
             {
                 items.AddSeparator();
             }
             items.AddActions(
                 new MenuAction("createBranch", "Create branch for task {0}".FormatInvariant(taskId), true,
                     () => CreateBranch(taskId)),
                 new MenuAction("goToBranch", "Go to branch for task {0}".FormatInvariant(taskId), true,
                     () => GoToBranchFor(taskId))
             );
         }
     }
 }
開發者ID:olivierdagenais,項目名稱:branchreview,代碼行數:29,代碼來源:TaskBrowser.cs

示例3: AddBuildSpecificActions

 private void AddBuildSpecificActions(Menu.MenuItemCollection items, bool needsLeadingSeparator)
 {
     var selectedItems = builds.Grid.SelectedRows;
     if (selectedItems.Count > 0)
     {
         if (needsLeadingSeparator)
         {
             items.AddSeparator();
         }
         var row = selectedItems[0].DataRow;
         var buildId = row["ID"];
         var buildName = row["Name"];
         var builtInActions = new[]
         {
             new MenuAction("defaultOpen", "&Open", true,
                         () => SetCurrentBuild(buildId, buildName) ),
         };
         items.AddActions(builtInActions);
         var specificActions = _buildRepository.GetBuildActions(buildId);
         if (specificActions.Count > 0)
         {
             items.AddSeparator();
             items.AddActions(specificActions);
         }
     }
 }
開發者ID:olivierdagenais,項目名稱:branchreview,代碼行數:26,代碼來源:BuildBrowser.cs

示例4: AddSubMenu

    private   void AddSubMenu( MenuCommand parentMenuCommand, Menu.MenuItemCollection items )
    {
      for ( int i = 0; i < items.Count; i++ )
      {
        // I know these menu items are actually MenuItemExs
        MenuItemEx item = (MenuItemEx)items[i];

        Bitmap bmp = ( item.Icon != null ) ? (Bitmap)item.Icon : 
          ( ( item.ImageList != null ) ? 
          (Bitmap)item.ImageList.Images[ item.ImageIndex ] : null ); 

        EventHandler hndl = item.ClickHandler;

        // if menu item does not have any ClickHandler then attach own
        if( hndl == null )
        {
          hndl = new EventHandler( RaiseMenuItemClick );
        }

        MenuCommand currentMenuCommand = new MenuCommand(item.Text, bmp,
          (Shortcut)item.Shortcut, hndl, item);
        
        currentMenuCommand.Checked = item.Checked;
        currentMenuCommand.Enabled = item.Enabled;
        
        parentMenuCommand.MenuCommands.Add(currentMenuCommand);
        
        if ( item.MenuItems.Count > 0 )
          AddSubMenu(currentMenuCommand, item.MenuItems);
      }
    }
開發者ID:ewosp,項目名稱:sycorax,代碼行數:31,代碼來源:ChevronMenu.cs

示例5: ScreenToMenu

		internal static Point ScreenToMenu (Menu menu, Point pnt)		
		{
			int x = pnt.X;
			int y = pnt.Y;
			XplatUI.ScreenToMenu (menu.Wnd.window.Handle, ref x, ref y);
			return new Point (x, y);
		}	
開發者ID:stabbylambda,項目名稱:mono,代碼行數:7,代碼來源:MenuAPI.cs

示例6: CreateMenuNode

 private TreeNode CreateMenuNode(Menu menu)
 {
     TreeNode node = new TreeNode(menu.Title) { Tag = menu };
     UpdateTreeNodeText(menu, "Title", node);
     treeView1.Nodes.Add(node);
     return node;
 }
開發者ID:Daimakaicho,項目名稱:MenuDesigner,代碼行數:7,代碼來源:Form1.cs

示例7: ItemsChanged

 internal virtual void ItemsChanged(int change, Menu menu)
 {
     if (this.form != null)
     {
         this.form.MenuChanged(change, menu);
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:7,代碼來源:MainMenu.cs

示例8: AddControlMenuItems

        public static void AddControlMenuItems(Menu.MenuItemCollection pParent, AemInstance pInstance)
        {
            List<MenuItem> menuItems = new List<MenuItem>();
              MenuItem item;

              item = new MenuItem();
              item.Text = "Start instance";
              item.Click += new EventHandler(ControlStartInstance);
              menuItems.Add(item);

              item = new MenuItem();
              item.Text = "Stop instance";
              item.Click += new EventHandler(ControlStopInstance);
              menuItems.Add(item);

              item = new MenuItem();
              item.Text = "Kill instance";
              item.Click += new EventHandler(ControlKillInstance);
              menuItems.Add(item);

              foreach (MenuItem i in menuItems) {
            i.Tag = pInstance;
              }

              pParent.AddRange(menuItems.ToArray());
        }
開發者ID:wcm-io-devops,項目名稱:aem-manager,代碼行數:26,代碼來源:AemActions.cs

示例9: AddItems

        private static void AddItems(Menu.MenuItemCollection items, IntPtr hMenu, int index, ref int cmdId)
        {
            foreach (MenuItem menu in items)
            {
                string menuText = menu.Text;
                if (menu.IsParent)
                {
                    IntPtr popMenu = CreatePopupMenu();
                    InsertMenu(hMenu, index, MenuFlags.MF_BYPOSITION | MenuFlags.MF_POPUP, popMenu.ToInt32(), ref menuText);
                    AddItems(menu.MenuItems, popMenu, 0, ref cmdId);
                }
                else
                {
                    if (menuText == "-")
                        InsertMenu(hMenu, index, MenuFlags.MF_BYPOSITION | MenuFlags.MF_SEPARATOR, cmdId, ref menuText);
                    else
                        InsertMenu(hMenu, index, MenuFlags.MF_BYPOSITION, cmdId, ref menuText);
                    
                    cmdId++;
                }
                menu.Text = menuText;
                index++;
            }

        }
開發者ID:kthompson,項目名稱:gitty.shell,代碼行數:25,代碼來源:ContextMenuHandlerBase.cs

示例10: AddShelvesetSpecificActions

 private void AddShelvesetSpecificActions(Menu.MenuItemCollection items, bool needsLeadingSeparator)
 {
     var selectedItems = shelvesetGrid.Grid.SelectedRows;
     if (selectedItems.Count > 0)
     {
         if (needsLeadingSeparator)
         {
             items.AddSeparator();
         }
         var row = selectedItems[0].DataRow;
         var shelvesetId = row["ID"];
         var shelvesetName = (string) row["Name"];
         var builtInActions = new[]
         {
             new MenuAction("defaultInspect", "&Inspect", true,
                            () => SetCurrentShelveset(shelvesetId, shelvesetName) ),
         };
         items.AddActions(builtInActions);
         var specificActions = _shelvesetRepository.GetShelvesetActions(shelvesetId);
         if (specificActions.Count > 0)
         {
             items.AddSeparator();
             items.AddActions(specificActions);
         }
     }
 }
開發者ID:olivierdagenais,項目名稱:branchreview,代碼行數:26,代碼來源:ShelvesetBrowser.cs

示例11: TuringMachineSetup

 public TuringMachineSetup(Menu menuForm)
 {
     this.menuForm = menuForm;
     alphabetSetupForm = new AlphabetSetup(this);
     startingStringFrom = new StartingString(this);
     statesSetupForm = new States(this);
     InitializeComponent();
 }
開發者ID:Thobias83,項目名稱:TileSetGenerator,代碼行數:8,代碼來源:TuringMachineSetup.cs

示例12: MenuItemProvider

		public MenuItemProvider (SWF.MenuItem menuItem) :
			base (menuItem)
		{
			this.menuItem = menuItem;
			parentMenu = mainMenu =	menuItem.GetMainMenu ();
			if (parentMenu == null)
				parentMenu = menuItem.GetContextMenu ();
		}
開發者ID:mono,項目名稱:uia2atk,代碼行數:8,代碼來源:MenuItemProvider.cs

示例13: yobaivan

        GameState state; //индикатор состояния игры

        #endregion Fields

        #region Constructors

        public yobaivan()
        {
            InitializeComponent();
            Canvas = this.CreateGraphics(); //рисуем на всей форме
            state = new GameState();
            state = GameState.start;
            menu = new Menu();
            game = new Game();
        }
開發者ID:stepanton,項目名稱:Jumper,代碼行數:15,代碼來源:yoba-ivan.cs

示例14: selectControlbyName

 public void selectControlbyName(Menu name)
 {
     foreach (MenuControl menuControl in menuControls){
         if (menuControl.accessMenuName == name){
             menuControl.activateControl();
             currentMenuIndex = menuControls.IndexOf(menuControl);
             break;
         }
     }
 }
開發者ID:am0rphyst,項目名稱:X-O-Genesis,代碼行數:10,代碼來源:MenuBar.cs

示例15: UpdateItems

		private void UpdateItems()
		{
			this.selectedMenuItem = null;

			this.MenuItems.Clear();

			Size imageSize = GetImageSize(this.items);
			foreach (CommandBarItem item in this.items)
			{
				this.MenuItems.Add(new MenuBarItem(item, imageSize, this.font, this.mnemonics));
			}
		}
開發者ID:heon21st,項目名稱:flashdevelop,代碼行數:12,代碼來源:CommandBarContextMenu.cs


注:本文中的System.Windows.Forms.Menu類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。