当前位置: 首页>>代码示例>>C#>>正文


C# Menu.Append方法代码示例

本文整理汇总了C#中Menu.Append方法的典型用法代码示例。如果您正苦于以下问题:C# Menu.Append方法的具体用法?C# Menu.Append怎么用?C# Menu.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Menu的用法示例。


在下文中一共展示了Menu.Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MyMenuBarFunc

    public static MenuBar MyMenuBarFunc()
    {
        MenuBar item0 = new MenuBar();

        Menu item1 = new Menu();
        item1.Append( (int)MenuIDs.wxID_ABOUT, "&About...", "Helptext for About" );
        item1.AppendSeparator();

        Menu item2 = new Menu();
        item2.Append( ID_TEST1, "Test 1\tF1", "", ItemKind.wxITEM_CHECK );
        item2.Append( ID_TEST2, "Test 2\tF2", "", ItemKind.wxITEM_CHECK );
        item2.Append( ID_TEST3, "Test 3\tF3", "", ItemKind.wxITEM_CHECK );
        item1.Append( ID_MENU, "Submenu", item2, "" );

        Menu item3 = new Menu();
        item3.Append( ID_RADIO, "Radio 1", "", ItemKind.wxITEM_RADIO );
        item3.Append( ID_RADIO, "Radio 2", "", ItemKind.wxITEM_RADIO );
        item1.Append( ID_MENU, "Radio submenu", item3, "" );

        item1.AppendSeparator();
        item1.Append( (int)MenuIDs.wxID_EXIT, "&Quit\tAlt-Q", "Helptext for Quit" );
        item0.Append( item1, "&File" );

        return item0;
    }
开发者ID:Dovedanhan,项目名称:wxPython-In-Action,代码行数:25,代码来源:menu_wdr.cs

示例2: OnPlaceRightClicked

 protected void OnPlaceRightClicked(Place place)
 {
     MenuItem openPlace;
     MenuItem addToReserve;
     MenuItem removeFromReserve;
     MenuItem openReserve;
     Menu dropDown = new Menu ();
     openPlace = new MenuItem ("Открыть место");
     openPlace.Activated += (s,args) => {
         var dlg = new PlaceDlg (place.Id);
         dlg.Show();
         dlg.Run();
         dlg.Destroy();
     };
     openPlace.Show ();
     dropDown.Append (openPlace);
     if (planviewwidget1.CurrentReserve != null) {
         if (planviewwidget1.CurrentReserve.Places.Any(p=>p.Id==place.Id)) {
             removeFromReserve = new MenuItem ("Удалить из резерва");
             removeFromReserve.Activated += (s, args) => {
                 planviewwidget1.CurrentReserve.Places.Remove(
                     planviewwidget1.CurrentReserve.Places.Where(p=>p.Id==place.Id).Single()
                 );
                 OnReserveChanged(this,null);
             };
             dropDown.Append (removeFromReserve);
             removeFromReserve.Show ();
         }else{
             Polygon polygon = planviewwidget1.Floor.Polygons.Single (p => p.Place.Id == place.Id);
             if (polygon.Status == PlaceStatus.Vacant) {
                 addToReserve = new MenuItem ("Добавить в резерв");
                 addToReserve.Activated += (s, args) => {
                     planviewwidget1.CurrentReserve.Places.Add (place);
                     OnReserveChanged (this, null);
                 };
                 dropDown.Append (addToReserve);
                 addToReserve.Show ();
             }
         }
     } else {
         Reserve reserve;
         using (var tempUoW = UnitOfWorkFactory.CreateWithoutRoot ()) {
             reserve = tempUoW.Session.QueryOver<Reserve> ().Where(r=>r.Date>DateTime.Today).JoinQueryOver<Place>(r=>r.Places).Where(p=>p.Id==place.Id).SingleOrDefault ();
         }
         if (reserve!= null) {
             openReserve = new MenuItem ("Открыть резерв");
             openReserve.Activated += (s, args) => {
                 uow = UnitOfWorkFactory.CreateForRoot<Reserve>(reserve.Id);
                 planviewwidget1.CurrentReserve = uow.Root;
                 reserveDeleteButton.Sensitive=true;
                 OnReserveChanged (this, null);
             };
             dropDown.Append (openReserve);
             openReserve.Show ();
         }
     }
     dropDown.Popup ();
 }
开发者ID:QualitySolution,项目名称:LeaseAgreement,代码行数:58,代码来源:MainWinMap.cs

示例3: CreateMyMenuBar

    // WDR: methods for MyFrame
    public void CreateMyMenuBar()
    {
        Menu file_menu = new Menu();
        file_menu.Append( (int)MenuIDs.wxID_ABOUT, "About...", "Program info" );
        file_menu.Append( (int)MenuIDs.wxID_EXIT, "Quit...", "Quit program" );

        MenuBar menu_bar = new MenuBar();
        menu_bar.Append( file_menu, "File" );

        MenuBar = menu_bar;
    }
开发者ID:Dovedanhan,项目名称:wxPython-In-Action,代码行数:12,代码来源:minimal.cs

示例4: MyMenuBarFunc

    public static MenuBar MyMenuBarFunc()
    {
        MenuBar item0 = new MenuBar();

        Menu item1 = new Menu();
        item1.Append( (int)MenuIDs.wxID_ABOUT, "About\tAlt-A", "" );
        item1.Append( (int)MenuIDs.wxID_SAVE, "Save\tAlt-S", "" );
        item1.Append( (int)MenuIDs.wxID_EXIT, "Quit\tAlt-Q", "" );
        item0.Append( item1, "File" );

        return item0;
    }
开发者ID:Dovedanhan,项目名称:wxPython-In-Action,代码行数:12,代码来源:toolbar_wdr.cs

示例5: MainWindow

    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Application.Init ();

            this.Resize(640,480);
            //menu bar very top
            MenuBar mb = new MenuBar ();
            Menu fileMenu = new Menu ();
            MenuItem menuItem = new MenuItem ("_File");
            menuItem.Submenu = fileMenu;
            mb.Append(menuItem);
            MenuItem menuFileQuit = new MenuItem("Quit");
            fileMenu.Append(menuFileQuit);
            vboxMain.PackStart(mb,false,false,0);

            //toolbar
            Toolbar tbTop = new Toolbar ();
            //toolbutton Staff
            ToolButton tbStaff = new ToolButton (Gtk.Stock.OrientationPortrait);
            tbStaff.Label="Staff";
            tbStaff.IsImportant=true;
            tbStaff.Clicked += HandleTbStaffClicked;
            tbTop.Insert(tbStaff,0);
            //toolbutton Clients
            ToolButton tbClients = new ToolButton (Gtk.Stock.About);
            tbClients.Label="Clients";
            tbClients.IsImportant=true;
            tbClients.Clicked+= HandleTbClientsClicked;
            tbTop.Insert(tbClients,1);
            //media bar
            Label lbMediaTemp = new Label ();
            lbMediaTemp.Text="Media holder";
            lbMediaTemp.Show();
            //pack the toolbar and media bar in the top hbox//
            hbTop.PackStart(tbTop);
            hbTop.PackStart(lbMediaTemp);
            //pack the top hbox in the main vbox
            vboxMain.PackStart(hbTop,false,false,1);
            // horizontal pane
            verticalPane.Position=200;
            verticalPane.Pack1(scrollWindowLeft,false,false);
            verticalPane.Pack2(scrollWindowRight,false,false);
            vboxMain.PackStart(verticalPane);
            scrollWindowLeft.Add(viewPortLeft);

            scrollWindowRight.Add(viewPortRight);
            Label lbMain = new Label ();
            lbMain.Text= "main";
            viewPortRight.Add(lbMain);
            verticalPane.ShowAll();
            //status bar very bottom
            Statusbar sb = new Statusbar ();
            vboxMain.PackStart(sb,false,false,1);

            this.Add(vboxMain);
            //hb1.Add(tbTop);
            this.ShowAll ();
        Build ();
    }
开发者ID:stemartincouk,项目名称:gsalon,代码行数:60,代码来源:MainWindow.cs

示例6: IconPopupHandler

	void IconPopupHandler (object o, PopupMenuArgs args)
	{
		Menu popup = new Menu ();
		
		MenuItem item = new MenuItem ("About");
		item.Activated += new EventHandler (OnMenuAbout);
		popup.Append (item);
		
		item = new MenuItem ("Quit");
		item.Activated += new EventHandler (OnCloseButtonClicked);
		popup.Append (item);
		
		popup.ShowAll ();
		statusIcon.PresentMenu (popup, 3, Gtk.Global.CurrentEventTime);
//		popup.Popup ();
	}
开发者ID:dfr0,项目名称:moon,代码行数:16,代码来源:PanelWindow.cs

示例7: BuildBookMarkMenu

	protected void BuildBookMarkMenu()
	{
		MenuItem bmrks = new MenuItem(Catalog.GetString("_Bookmarks"));
		mainmenubar.Insert(bmrks, 5);	
		Menu bmrksMenu = new Menu();
		MenuItem newBList = new MenuItem(Catalog.GetString("_Create Bookmark List..."));
		MenuItem delBList = new MenuItem(Catalog.GetString("_Delete Bookmark List..."));
		bmrkLists = new MenuItem(Catalog.GetString("Bookmark _List"));
		addVisibleCaches = new MenuItem(Catalog.GetString("_Add All Unfiltered Caches to"));
		addCacheTo = new MenuItem(Catalog.GetString("Add _Selected Cache to"));
		addCacheTo.Sensitive = false;
		removeSelected = new MenuItem(Catalog.GetString("_Remove Selected Cache from Bookmark List"));
		bmrksMenu.Append(bmrkLists);
		bmrksMenu.Append(addVisibleCaches);
		bmrksMenu.Append(addCacheTo);
		bmrksMenu.Append(removeSelected);
		bmrksMenu.Append(new MenuItem());
		bmrksMenu.Append(newBList);
		bmrksMenu.Append(delBList);
		
	
		bmrks.Submenu = bmrksMenu;
		newBList.Activated += HandleNewBListActivated;
		removeSelected.Activated += HandleRemoveSelectedActivated;
		delBList.Activated += HandleDelBListActivated;
		bmrks.ShowAll();
	}
开发者ID:TweetyHH,项目名称:Open-Cache-Manager,代码行数:27,代码来源:MainWindow.cs

示例8: MainWindow

    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        _regexes = new Dictionary<string, string>();

        _regexes.Add("Possible Email Addresses",@"[A-Za-z0-9._%+-][email protected][A-Za-z0-9.-]+\.[A-Za-z]{2,4}");
        _regexes.Add("Possible Environment Variables", @"^[A-Za-z]{3,}=[A-Za-z]+");
        _regexes.Add("Possible File Paths", @"[A-Za-z]:\\");
        _regexes.Add("Possible URLS", @"/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w][email protected])?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w][email protected])[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/");
        _regexes.Add("Custom", string.Empty);

        Build ();
        this.Title = "VolatileMinds Pagefile Analyzer";
        SetPosition (Gtk.WindowPosition.Center);
        DeleteEvent += delegate(object o, DeleteEventArgs args) {
            Application.Quit ();
        };

        MenuBar bar = new MenuBar ();

        Menu fileMenu = new Menu ();
        MenuItem fileMenuItem = new MenuItem ("File");
        fileMenuItem.Submenu = fileMenu;

        MenuItem exit = new MenuItem ("Exit");
        exit.Activated += delegate(object sender, EventArgs e) {
            Application.Quit ();
        };

        MenuItem openFile = new MenuItem ("Open file...");

        openFile.Activated += OpenFile;

        fileMenu.Append (openFile);
        fileMenu.Append (exit);

        bar.Append (fileMenuItem);

        _vbox = new VBox (false, 2);
        _vbox.PackStart (bar, false, false, 0);

        this.Add (_vbox);
        this.ShowAll ();
    }
开发者ID:brandonprry,项目名称:volatile_reader,代码行数:44,代码来源:MainWindow.cs

示例9: InitMenuBar

        private void InitMenuBar()
        {
            MenuBar menuBar = new MenuBar();
            Menu fileMenu = new Menu();

            fileMenu.Append(ID_FileExit, "E&xit\tAlt+F4", "Exit this app");
            EvtMenu(ID_FileExit, (s, e) => Close());

            menuBar.Append(fileMenu, "&File");
            MenuBar = menuBar;
        }
开发者ID:joeferner,项目名称:fivevolt,代码行数:11,代码来源:MainFrame.cs

示例10: Main

    public static void Main()
    {
        Application.Init ();

                Window win = new Window ("Test");
                win.Resize (200, 200);

                Label label = new Label ();
                label.Text = "Hello, world!";

                win.Add (label);

                ApplicationIndicator indicator = new ApplicationIndicator ("Example",
                                                                           "applications-microblogging-panel",
                                                                           AppIndicatorCategory.ApplicationStatus);

                indicator.AppIndicatorStatus = AppIndicatorStatus.Attention;

                Menu menu = new Menu ();
                var foo = new MenuItem ("Foo");
                menu.Append (foo);
                foo.Activated += delegate {
                        System.Console.WriteLine ("Foo item has been activated");
                };

                menu.Append (new MenuItem ("Bar"));

                indicator.Menu = menu;
                indicator.Menu.ShowAll ();

                indicator.SecondaryActivateTarget = foo;

                win.ShowAll ();

                Application.Run ();
    }
开发者ID:ArcticaProject,项目名称:libayatana-appindicator,代码行数:36,代码来源:AyatanaIndicatorExample.cs

示例11: PopulateCategoryOptionMenu

		private void PopulateCategoryOptionMenu ()
		{
			categories = new ArrayList ();
			categories.Add (tag_store.RootCategory);
			PopulateCategories (categories, tag_store.RootCategory);

			Menu menu = new Menu ();

			foreach (Category category in categories)
				menu.Append (TagMenu.TagMenuItem.IndentedItem (category));

			category_option_menu.Sensitive = true;

			menu.ShowAll ();
			category_option_menu.Menu = menu;
		}
开发者ID:guadalinex-archive,项目名称:guadalinex-v6,代码行数:16,代码来源:TagCommands.cs

示例12: SharpApp

    public SharpApp()
        : base("Simple menu")
    {
        SetDefaultSize(250,200);
        SetPosition(WindowPosition.Center);
        DeleteEvent+= delegate { Application.Quit();};

        MenuBar mb = new MenuBar();
        Menu filemenu = new Menu();
        MenuItem file = new MenuItem("File");
        file.Submenu = filemenu;

        MenuItem exit = new MenuItem("Exit");
        exit.Activated += OnActivated;
        filemenu.Append(exit);

        mb.Append(file);

        VBox vbox = new VBox(false, 2);
        vbox.PackStart(mb, false, false, 0);
        Add(vbox);
        ShowAll();
    }
开发者ID:Jimmyscene,项目名称:Random,代码行数:23,代码来源:menu.cs

示例13: OnButtonPress

            private void OnButtonPress(object o,
						    ButtonPressEventArgs args)
            {
                if (args.Event.Button != 3)
                    return;
                if (viewer.Games == null
                    || viewer.Games.Count == 0)
                    return;

                ImageMenuItem item =
                    new ImageMenuItem (Catalog.
                               GetString
                               ("_View Game"));
                item.Image =
                    new Image (Stock.Open, IconSize.Menu);
                TreePath path;
                path = view.GetPathAtPos (System.Convert.
                              ToInt16 (args.Event.
                                   X),
                              System.Convert.
                              ToInt16 (args.Event.
                                   Y));
                Menu menu = new Menu ();

                if (path != null)
                  {
                      view.SelectPath (path);
                      item.Activated +=
                          OnViewPopupItemActivated;
                      menu.Append (item);
                  }

                if (viewer.PrintHandler != null)
                  {
                      ImageMenuItem printItem =
                          new ImageMenuItem (Catalog.
                                     GetString
                                     ("_Print Games"));
                      printItem.Image =
                          new Image (Stock.Print,
                                 IconSize.Menu);
                      printItem.Activated +=
                          viewer.PrintHandler.
                          OnPrintActivated;
                      menu.Append (printItem);
                  }

                menu.ShowAll ();
                menu.Popup ();
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:50,代码来源:GamesListWidget.cs

示例14: ViewerMenuBar

            public ViewerMenuBar()
                : base()
            {
                /* File menu */
                fileOpenSeparator = new SeparatorMenuItem ();
                saveAsSeparator = new SeparatorMenuItem ();
                saveAsMenuItem =
                    new ImageMenuItem (Catalog.
                               GetString
                               ("Save _As"));
                saveAsMenuItem.Image =
                    new Image (Stock.Refresh,
                           IconSize.Menu);
                printMenuItem =
                    new ImageMenuItem (Catalog.
                               GetString
                               ("_Print"));
                printMenuItem.Image =
                    new Image (Stock.Print,
                           IconSize.Menu);

                Menu menu = fileMenuItem.Submenu as Menu;
                int i = 0;
                  menu.Insert (fileOpenSeparator, i++);
                  menu.Insert (saveAsMenuItem, i++);
                  menu.Insert (saveAsSeparator, i++);
                  menu.Insert (printMenuItem, i++);

                /* Action menu */
                  actionMenuItem =
                    new MenuItem (Catalog.
                              GetString ("_Action"));
                  AppendAfter (fileMenuItem, actionMenuItem);
                  menu = new Menu ();
                  actionMenuItem.Submenu = menu;
                  switchSideMenuItem =
                    new ImageMenuItem (Catalog.
                               GetString
                               ("_Switch Side"));
                  switchSideMenuItem.Image =
                    new Image (Stock.Refresh,
                           IconSize.Menu);
                  menu.Append (switchSideMenuItem);

                /* Edit menu */
                  menu = editMenuItem.Submenu as Menu;
                  moveCommentMenuItem =
                    new MenuItem (Catalog.
                              GetString
                              ("Move _Comment"));
                  menu.Append (moveCommentMenuItem);

                /* Export As menu */
                  exportAsMenuItem =
                    new MenuItem (Catalog.
                              GetString
                              ("_Export As"));
                  AppendAfter (editMenuItem,
                           exportAsMenuItem);

                /* View menu */
                  menu = viewMenuItem.Submenu as Menu;
                  highlightMoveMenuItem =
                    new CheckMenuItem (Catalog.
                               GetString
                               ("_Highlight Move"));
                  menu.Append (highlightMoveMenuItem);
                  ShowAll ();
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:69,代码来源:ViewerMenuBar.cs

示例15: OnTogglebuttonToggled

    protected void OnTogglebuttonToggled(object sender, System.EventArgs e)
    {
        if (addNewOperation_togglebutton.Active)
        {
            Menu menu = new Menu();
            int w, h;
            menu.GetSizeRequest(out w, out h);
            int menu_width = left_vbox.Allocation.Width;

            menu.SetSizeRequest(menu_width, h);

            Dictionary<MenuItem, Type> stage_operation_types = new Dictionary<MenuItem, Type>();

            for (int i = 0; i < mStageOperationTypes.Length; i++)
            {
                string name = StageOperationDescriptionAttribute.GetName(mStageOperationTypes[i]);
                if (name == null) name = mStageOperationTypes[i].Name;
                string description = StageOperationDescriptionAttribute.GetDescription(mStageOperationTypes[i]);

                MenuItem item = new MenuItem();

                VBox item_vbox = new VBox();
                item_vbox.BorderWidth = 4;
                item_vbox.Show();

                Label lbl_name = new Label();
                lbl_name.Text = name;
                lbl_name.Justify = Justification.Left;
                lbl_name.Xalign = 0;

                // Setting the name font
                double name_size_k = 1.1;
                Pango.FontDescription name_fd = FontHelpers.ScaleFontSize(lbl_name, name_size_k);
                name_fd.Weight = Pango.Weight.Bold;
                lbl_name.ModifyFont(name_fd);

                item_vbox.Add(lbl_name);
                lbl_name.Show();

                if (description != null && description != "")
                {
                    Label lbl_desc = new Label(description);
                    lbl_desc.LineWrapMode = Pango.WrapMode.Word;
                    lbl_desc.LineWrap = true;
                    lbl_desc.Wrap = true;

                    // Setting the description font
                    double desc_size_k = 0.9;
                    Pango.FontDescription desc_fd = FontHelpers.ScaleFontSize(lbl_desc, desc_size_k);
                    lbl_desc.ModifyFont(desc_fd);

                    item_vbox.Add(lbl_desc);
                    lbl_desc.Show();
                    item_vbox.SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
                        lbl_desc.WidthRequest = args.Allocation.Width - 10;
                    };
                }

                item.Child = item_vbox;
                stage_operation_types.Add(item, mStageOperationTypes[i]);

                item.Activated += delegate(object s, EventArgs ea) {
                    mStage.CreateAndAddNewItem(stage_operation_types[(MenuItem)s]).Active = true;
                    GtkScrolledWindow.HscrollbarPolicy = PolicyType.Never;
                    GtkScrolledWindow.Vadjustment.Value = GtkScrolledWindow.Vadjustment.Upper;
                    ArrangeVBoxes();

                };

                menu.Append(item);
                item_vbox.CheckResize();
                //lbl_desc.WidthRequest = ww;
            }
            menu.Deactivated += delegate {
                addNewOperation_togglebutton.Active = false;
            };

            menu.ShowAll();
            menu.Popup(null, null, delegate (Menu m, out int x, out int y, out bool push_in) {
                int x1, y1, x0, y0;
                GdkWindow.GetOrigin(out x0, out y0);
                left_vbox.TranslateCoordinates(this, 0, 0, out x1, out y1);
                x = x0 + x1;
                y = y0 + y1;
                push_in = false;
            }, 0, 0);
        }
    }
开发者ID:bigfatbrowncat,项目名称:CatEye,代码行数:88,代码来源:StageEditorWindow.cs


注:本文中的Menu.Append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。