• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.MenuItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Forms.MenuItem的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms.MenuItem类的具体用法?C# System.Windows.Forms.MenuItem怎么用?C# System.Windows.Forms.MenuItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



System.Windows.Forms.MenuItem类属于命名空间,在下文中一共展示了System.Windows.Forms.MenuItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnStartup

        protected override void OnStartup(System.Windows.StartupEventArgs e)
        {
            var language = SettingVM.Instance.Language;
            ResourcesHelper.SetLanguage(language);

            UpdateLanguage();

            SettingVM.Instance.PropertyChanged += Instance_PropertyChanged;

            _notifyIcon.Icon = RemoteShutdown.Client.Properties.Resources.app;
            _notifyIcon.Visible = true;

            _setting.Click += Setting_Click;

            _exit.Click += Exit_Click;

            System.Windows.Forms.MenuItem[] childen = new System.Windows.Forms.MenuItem[] { _setting, _exit };
            _notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(childen);

            _notifyIcon.MouseClick += NotifyIcon_MouseClick;

            if (SettingVM.Instance.First) // 设置开机运行
            {
                SettingVM.Instance.Boot = true;
                SettingVM.Instance.First = false;
                ShowSettingWindow();
            }

            base.OnStartup(e);
        }
开发者ID:Jitlee,项目名称:RemoteShutdown,代码行数:30,代码来源:App.xaml.cs


示例2: AddAction

        public void AddAction(IAction action)
        {
            string ID = action.ID;
            System.Windows.Forms.MenuItem menuItem = new System.Windows.Forms.MenuItem(ID);
            menuItem.Click += new System.EventHandler(this.MainWindow_ActionSelect);
            menuItem.Tag = action;

            System.Windows.Forms.MenuItem menuMain = this.menuItemActions;
            if (menuMain == null)
            {
                LoggerFactory.Default.Log("Could not register IAction in IDE", action.EffectiveID);
                return;
            };

            string category = action.Category;
            if ((category == "") || (category == null))
            { menuMain.MenuItems.Add(menuItem); }
            else
            {
                System.Windows.Forms.MenuItem categoryItem = findCategoryMenu(menuMain, category);
                if (categoryItem == null)
                {
                    categoryItem = new System.Windows.Forms.MenuItem(category);
                    menuMain.MenuItems.Add(categoryItem);
                }
                addSortedActionInCategory(categoryItem, menuItem);
            }
        }
开发者ID:fernandolucasrodriguez,项目名称:qit,代码行数:28,代码来源:WindowMain.cs


示例3: Start

		public static void Start(EventHandler onShow, EventHandler onClose, EventHandler onShowLogs)
		{
			RefreshTaskbarNotificationArea();
			AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
			_notifyIcon = new System.Windows.Forms.NotifyIcon();
			Stream iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/ServerFS2;component/FS2.ico")).Stream;
			_notifyIcon.Icon = new System.Drawing.Icon(iconStream);
			_notifyIcon.Visible = true;

			_notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu();
			var menuItem1 = new System.Windows.Forms.MenuItem();
			menuItem1.Text = "Показать";
			menuItem1.Click += new EventHandler(onShow);
			_notifyIcon.ContextMenu.MenuItems.Add(menuItem1);

			var menuItem2 = new System.Windows.Forms.MenuItem();
			menuItem2.Text = "Выход";
			menuItem2.Click += new EventHandler(onClose);
			_notifyIcon.ContextMenu.MenuItems.Add(menuItem2);

			var menuItem3 = new System.Windows.Forms.MenuItem();
			menuItem3.Text = "Логи";
			menuItem3.Click += new EventHandler(onShowLogs);
			_notifyIcon.ContextMenu.MenuItems.Add(menuItem3);

			_notifyIcon.Text = "Сервер FS2";
		}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:27,代码来源:NotifyIconService.cs


示例4: InitializeComponent

		private void InitializeComponent()
		{
			m_MainMenu = new System.Windows.Forms.MainMenu( );

			// File sub-menu
			m_FileMenu = new System.Windows.Forms.MenuItem( "&File" );
			m_FileExit = new System.Windows.Forms.MenuItem( "&Exit",
				this.FileExit, System.Windows.Forms.Shortcut.CtrlQ );

			this.SuspendLayout( );

			m_MainMenu.MenuItems.Add( m_FileMenu );
			m_FileMenu.MenuItems.Add( m_FileExit );

			this.Menu = m_MainMenu;

			m_Orthographic0 = new OrthographicViewControl( );

			this.Controls.Add( m_Orthographic0 );

			m_Orthographic0.Dock = System.Windows.Forms.DockStyle.Fill;
			m_Orthographic0.Location = new System.Drawing.Point( 0, 0 );
			m_Orthographic0.Name = "Orthographic View 0";

			this.components = new System.ComponentModel.Container();
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Name = "BBBEditor";
			this.Text = "Bang Bang Banquet Editor";
			this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
			this.ResumeLayout( false );
		}
开发者ID:RedRingRico,项目名称:BangBangBanquet-Editor,代码行数:31,代码来源:Editor.Designer.cs


示例5: InitNotifyIcon

        // private bool firstShowTip = true;
        private void InitNotifyIcon()
        {
            trayContextMenu = new System.Windows.Forms.ContextMenu();
            trayExitMenuItem = new System.Windows.Forms.MenuItem();
            trayMiniMenuItem = new System.Windows.Forms.MenuItem();
            trayViewHistorymenuItem = new System.Windows.Forms.MenuItem();

            trayContextMenu.MenuItems.AddRange(
                        new System.Windows.Forms.MenuItem[] { trayViewHistorymenuItem, trayMiniMenuItem, trayExitMenuItem });

            trayViewHistorymenuItem.Index = 0;
            trayViewHistorymenuItem.Text = "查看历史记录(&H)";
            trayViewHistorymenuItem.Click += new EventHandler(TrayViewHistoryMenuItem_Click);

            trayMiniMenuItem.Index = 1;
            trayMiniMenuItem.Text = "隐藏悬浮窗(&M)";
            trayMiniMenuItem.Click += new EventHandler(TrayMiniMenuItem_Click);

            trayExitMenuItem.Index = 2;
            trayExitMenuItem.Text = "退出(&E)";
            trayExitMenuItem.Click += new EventHandler(TrayExitMenuItem_Click);

            notifyIcon = new System.Windows.Forms.NotifyIcon();
            notifyIcon.BalloonTipText = "SmartMe已最小化到托盘,双击此处恢复窗口";
            notifyIcon.BalloonTipTitle = "SmartMe";
            notifyIcon.Text = "SmartMe";
            notifyIcon.Icon = new System.Drawing.Icon("icon.ico");
            notifyIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(notifyIcon_Click);
            notifyIcon.ContextMenu = this.trayContextMenu;
            ShowTrayIcon(true);	// Always show the icon
        }
开发者ID:Letractively,项目名称:lunar-thu,代码行数:32,代码来源:MiniWindow.xaml.cs


示例6: Main

        public Main()
        {
            InitializeComponent();
            if (isDebug.Equals("false"))
                this.Topmost = true;

            this.notifyIcon = new System.Windows.Forms.NotifyIcon();
            this.notifyIcon.BalloonTipText = "多电站演示系统正在运行!";
            this.notifyIcon.Text = "多电站演示系统!";
            this.notifyIcon.Icon = new System.Drawing.Icon("favicon.ico");
            this.notifyIcon.Visible = true;
            this.notifyIcon.ShowBalloonTip(1000);
            this.notifyIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(notifyIcon_MouseClick);

            System.Windows.Forms.MenuItem showWindow = new System.Windows.Forms.MenuItem("显示界面");
            showWindow.Click += new EventHandler(showWindow_Click);

            System.Windows.Forms.MenuItem exitSystem = new System.Windows.Forms.MenuItem("退出");
            exitSystem.Click += new EventHandler(exitSystem_Click);
            System.Windows.Forms.MenuItem[] menuItems = new System.Windows.Forms.MenuItem[] { showWindow, exitSystem };
            this.notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(menuItems);

            this.StateChanged += new EventHandler(MainWindow_StateChanged);

            setHook();

            autoRun();
            //GC.Collect();
            //GC.WaitForPendingFinalizers();
            //GC.Collect();
        }
开发者ID:dalinhuang,项目名称:loosoft,代码行数:31,代码来源:Main.xaml.cs


示例7: Load

        public override void Load()
        {
            m_form = new FormWidget("Scale Bar Legend");
            m_form.Location = oDefaultLocation;
            m_form.ClientSize = new System.Drawing.Size(150, 60);
            m_form.Text = "Scale Bar Legend";
            m_form.BackgroundColor = WidgetBackgroundColor;
            m_form.ParentWidget = DrawArgs.NewRootWidget;
            m_form.AutoHideHeader = true;
            m_form.VerticalScrollbarEnabled = false;
            m_form.HorizontalScrollbarEnabled = false;
            m_form.OnResizeEvent += new FormWidget.ResizeHandler(m_form_OnResizeEvent);
            m_form.OnVisibleChanged += new VisibleChangedHandler(m_form_OnVisibleChanged);
            m_form.BorderEnabled = false;

            m_scaleBar = new ScaleBarWidget();
            m_scaleBar.Location = new System.Drawing.Point(5, 0);
            m_form_OnResizeEvent(m_form, m_form.WidgetSize);
            m_scaleBar.ParentWidget = m_form;

            m_form.ChildWidgets.Add(m_scaleBar);

            bool visibility = false;

            m_menuItem = new System.Windows.Forms.MenuItem("Scale Bar Legend");
            m_menuItem.Click += new EventHandler(m_menuItem_Click);

            m_menuItem.Checked = visibility;
            m_form.Visible = visibility;

            //ParentApplication.ToolsMenu.MenuItems.Add(m_menuItem);
            DrawArgs.NewRootWidget.ChildWidgets.Add(m_form);

            base.Load();
        }
开发者ID:paladin74,项目名称:Dapple,代码行数:35,代码来源:ScaleBarLegend.cs


示例8: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            this.IsPostPanelExpand = true;
            this.IsFunctionPanelExpand = true;
            this.IsMessagePostPanelExpand = true;

            this.AuthPanel.OkButton.Click += new RoutedEventHandler(OkButton_Click);
            this.AuthPanel.PrevButton.Click += new RoutedEventHandler(PrevButton_Click);
            this.AuthPanel.NextButton.Click += new RoutedEventHandler(NextButton_Click);

            this.ReplyPanel.ReplyButton.Click += new RoutedEventHandler(ReplyPanelReplyButton_Click);
            this.ReplyPanel.CancelButton.Click += new RoutedEventHandler(ReplyPanelCancelButton_Click);

            #region Task Tray
            int ScreenWidth = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width;
            int Screenheigth = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;
            int AppWidth = (int)this.Width;
            int AppHeight = (int)this.Height;
            Canvas.SetLeft(this, ScreenWidth - AppWidth);  //ScreenWidth / 2 - AppWidth / 2;
            Canvas.SetTop(this, Screenheigth - AppHeight); //Screenheigth / 2 - AppHeight / 2;
            this.StateChanged += new EventHandler(MainWindow_StateChanged);
            this.taskIcon = new System.Windows.Forms.NotifyIcon();
            this.taskIcon.Visible = true;
            this.taskIcon.Icon = Properties.Resources.YammyyIcon;
            this.taskIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(taskIcon_MouseClick);
            this.taskIcon.ContextMenu = new System.Windows.Forms.ContextMenu();
            System.Windows.Forms.MenuItem item = new System.Windows.Forms.MenuItem("&Exit", taskIconItemExit_Click);
            this.taskIcon.ContextMenu.MenuItems.Add(item);
            #endregion

            System.Threading.Thread th = new System.Threading.Thread(new System.Threading.ThreadStart(InitialCheck));
            th.Start();
        }
开发者ID:changman,项目名称:yammyy,代码行数:35,代码来源:MainWindow.xaml.cs


示例9: AddMenuItem

        public void AddMenuItem(string name,Action action)
        {
            System.Windows.Forms.MenuItem item = new System.Windows.Forms.MenuItem(name);
            item.Click += new EventHandler(delegate { action.Invoke(); });

            this.notifyIcon.ContextMenu.MenuItems.Add(item);
        }
开发者ID:zecak,项目名称:CarryBag,代码行数:7,代码来源:WindowSysMin.cs


示例10: InitializeComponent

		/// <summary>
		/// This method is required for Windows Forms designer support.
		/// Do not change the method contents inside the source code editor. The Forms designer might
		/// not be able to load this method if it was changed manually.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.mainMenu = new System.Windows.Forms.MainMenu(this.components);
			this.menuItemSave = new System.Windows.Forms.MenuItem();
			this.menuItemSettings = new System.Windows.Forms.MenuItem();
			this.menuItemAbout = new System.Windows.Forms.MenuItem();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.SuspendLayout();
			// 
			// mainMenu
			// 
			this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
									this.menuItemSave,
									this.menuItemSettings,
									this.menuItemAbout,
									this.menuItem1,
									this.menuItem2});
			// 
			// menuItemSave
			// 
			this.menuItemSave.Index = 0;
			this.menuItemSave.Text = "Save image";
			// 
			// menuItemSettings
			// 
			this.menuItemSettings.Index = 1;
			this.menuItemSettings.Text = "Setting";
			// 
			// menuItemAbout
			// 
			this.menuItemAbout.Index = 2;
			this.menuItemAbout.Text = "About";
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 3;
			this.menuItem1.Text = "Refresh";
			// 
			// menuItem2
			// 
			this.menuItem2.Index = 4;
			this.menuItem2.Text = "GC";
			// 
			// MainForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(8, 21);
			this.ClientSize = new System.Drawing.Size(512, 512);
			this.MinimumSize = new System.Drawing.Size(160, 146);
			this.Name = "MainForm";
			this.Text = "Fractals 0.5 BETA";
			this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
			this.Resize += new System.EventHandler(this.Form1_Resize);
			this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picture_MouseUp);
			this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MainFormMouseMove);
			this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picture_MouseDown);
			this.ResumeLayout(false);
		}
开发者ID:dsrbecky,项目名称:Fractals,代码行数:64,代码来源:MainForm.Designer.cs


示例11: InitializeComponent

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.mainMenu1 = new System.Windows.Forms.MainMenu();
            this.mnuCancel = new System.Windows.Forms.MenuItem();
            this.mnuAction = new System.Windows.Forms.MenuItem();
            this.txtURL = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            // 
            // mainMenu1
            // 
           
            // 
            // mnuCancel
            // 
           
            // 
            // mnuOK
            // 
            // 
            // txtURL
            // 
            this.txtURL.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtURL.BackColor = System.Drawing.Color.White;
            this.txtURL.ForeColor = System.Drawing.Color.Black;
            this.txtURL.Location = new System.Drawing.Point(0, 29);
            this.txtURL.Multiline = true;
            this.txtURL.Name = "txtURL";
            this.txtURL.Size = new System.Drawing.Size(240, 91);
            this.txtURL.TabIndex = 0;
            // 
            // label1
            // 
            this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.label1.ForeColor = System.Drawing.Color.LightGray;
            this.label1.Location = new System.Drawing.Point(4, 4);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(233, 20);
            this.label1.Text = "Enter the URL:";
            // 
            // URLForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
            this.AutoScroll = true;
            this.BackColor = System.Drawing.Color.Black;
            this.ClientSize = new System.Drawing.Size(240, 268);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.txtURL);
            this.Menu = this.mainMenu1;
            this.Name = "URLForm";
            this.Text = "Enter a URL";
            this.ResumeLayout(false);

        }
开发者ID:JakeStevenson,项目名称:PockeTwit,代码行数:61,代码来源:URLForm.Designer.cs


示例12: WindowForm

 public WindowForm()
 {
     Text = "Window";
     System.Windows.Forms.MainMenu menu = new System.Windows.Forms.MainMenu();
     var item = new System.Windows.Forms.MenuItem();
     item.Text = "Exit";
     item.Click += new EventHandler(item_Click);
     menu.MenuItems.Add(item);
     Menu = menu;
 }
开发者ID:koush,项目名称:Xaml,代码行数:10,代码来源:WindowForm.cs


示例13: InitializeComponent

	private void InitializeComponent()
	{
            this.components = new System.ComponentModel.Container();
            this.MainMenu1 = new System.Windows.Forms.MainMenu(this.components);
            this.MenuItem1 = new System.Windows.Forms.MenuItem();
            this.itmSaveAs = new System.Windows.Forms.MenuItem();
            this.viewer = new AtasciiView();
            this.SuspendLayout();
            // 
            // MainMenu1
            // 
            this.MainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.MenuItem1});
            // 
            // MenuItem1
            // 
            this.MenuItem1.Index = 0;
            this.MenuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.itmSaveAs});
            this.MenuItem1.MergeType = System.Windows.Forms.MenuMerge.MergeItems;
            this.MenuItem1.Text = "&File";
            // 
            // itmSaveAs
            // 
            this.itmSaveAs.Index = 0;
            this.itmSaveAs.MergeOrder = 3;
            this.itmSaveAs.MergeType = System.Windows.Forms.MenuMerge.MergeItems;
            this.itmSaveAs.Text = "Save ATASCII As...";
            this.itmSaveAs.Click += new System.EventHandler(this.itmSaveAs_Click);
            // 
            // viewer
            // 
            this.viewer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.viewer.Location = new System.Drawing.Point(0, 0);
            this.viewer.Name = "viewer";
            this.viewer.Size = new System.Drawing.Size(304, 230);
            this.viewer.TabIndex = 0;
            // 
            // AtasciiFileViewer
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(304, 242);
            this.Controls.Add(this.viewer);
            this.Menu = this.MainMenu1;
            this.Name = "AtasciiFileViewer";
            this.Text = "AtasciiFileViewer";
            this.Load += new System.EventHandler(this.AtasciiFileViewer_Load);
            this.ResumeLayout(false);

	}
开发者ID:danlb2000,项目名称:Atari-Disk-Explorer,代码行数:52,代码来源:AtasciiFileViewer.cs


示例14: InitializeNotifyIcon

 private void InitializeNotifyIcon()
 {
     _notifyIcon = new NotifyIcon { Text = Infrastructure.Constant.Wox, Icon = Properties.Resources.app, Visible = true };
     _notifyIcon.Click += (o, e) => Visibility = Visibility.Visible;
     var open = new MenuItem(InternationalizationManager.Instance.GetTranslation("iconTrayOpen"));
     open.Click += (o, e) => Visibility = Visibility.Visible;
     var setting = new MenuItem(InternationalizationManager.Instance.GetTranslation("iconTraySettings"));
     setting.Click += (o, e) => App.API.OpenSettingDialog();
     var exit = new MenuItem(InternationalizationManager.Instance.GetTranslation("iconTrayExit"));
     exit.Click += (o, e) => Close();
     MenuItem[] childen = { open, setting, exit };
     _notifyIcon.ContextMenu = new ContextMenu(childen);
 }
开发者ID:zlphoenix,项目名称:Wox,代码行数:13,代码来源:MainWindow.xaml.cs


示例15: AttachGui

 public void AttachGui(GuiData guiData)
 {
     m_guiData = guiData;
     if (m_guiData.MainWindow is System.Windows.Forms.Form)
     {
         System.Windows.Forms.MenuItem menuItem = guiData.MenuItem as System.Windows.Forms.MenuItem;
         if (menuItem != null)
         {
             m_subMenuItem = new System.Windows.Forms.MenuItem("Debugger", menu_Click);
             menuItem.MenuItems.Add(m_subMenuItem);
         }
     }
 }
开发者ID:bobsummerwill,项目名称:ZXMAK2,代码行数:13,代码来源:Debugger.cs


示例16: MainWindow

        public MainWindow()
        {
            _icon = new System.Windows.Forms.NotifyIcon();
            _menu = new System.Windows.Forms.ContextMenu();

            _menu.Popup += _menu_Popup;

            // Versioni precedenti
            _prevoiusVersions = new System.Windows.Forms.MenuItem();
            _prevoiusVersions.Text = "Versioni precedenti...";
            _prevoiusVersions.Click += (object sender, EventArgs args) => {
                ApplicationController.Instance.ShowPreviousVers();
            };
            _menu.MenuItems.Add(0,_prevoiusVersions);

            // Logout
            _logout = new System.Windows.Forms.MenuItem();
            _logout.Text = "Logout";
            _logout.Click += (object sender, EventArgs args) =>
            {
                ApplicationController.Instance.Logout();
            };
            _menu.MenuItems.Add(1, _logout);

            // Login
            _login = new System.Windows.Forms.MenuItem();
            _login.Text = "Login";
            _login.Click += (object sender, EventArgs args) =>
            {
                ApplicationController.Instance.RequireLogin();
            };
            _menu.MenuItems.Add(2, _login);

            // Exit
            _exit = new System.Windows.Forms.MenuItem();
            _exit.Text = "Esci";
            _exit.Click += (object sender, EventArgs args) =>
            {
                ApplicationController.Instance.Shutdown(RETURN_VALUES.OK);
            };
            _menu.MenuItems.Add(3, _exit);

            _icon.ContextMenu = _menu;
            //this.WindowState = System.Windows.WindowState.Maximized;
            _icon.Icon = new System.Drawing.Icon(@"rockbox_small.ico");
            this._icon.Visible = true;
            InitializeComponent();
            this.Left = (System.Windows.SystemParameters.WorkArea.Width - this.Width) + System.Windows.SystemParameters.WorkArea.Left;
            this.Top = (System.Windows.SystemParameters.WorkArea.Height - this.Height) + System.Windows.SystemParameters.WorkArea.Top;
        }
开发者ID:albertogeniola,项目名称:MalnatiServer,代码行数:50,代码来源:MainWindow.xaml.cs


示例17: GetContextMenu

        private System.Windows.Forms.ContextMenu GetContextMenu()
        {
            System.Windows.Forms.ContextMenu menu = new System.Windows.Forms.ContextMenu();

            var exitItem = new System.Windows.Forms.MenuItem() { Text = "Exit" };
            exitItem.Click += exitItem_Click;

            var settingsItem = new System.Windows.Forms.MenuItem() { Text = "Settings" };
            settingsItem.Click += settingsItem_Click;

            menu.MenuItems.Add(settingsItem);
            menu.MenuItems.Add(exitItem);

            return menu;
        }
开发者ID:tomasmcguinness,项目名称:BeCharming,代码行数:15,代码来源:App.xaml.cs


示例18: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            System.Windows.Forms.NotifyIcon ni = new System.Windows.Forms.NotifyIcon();
            ni.Icon = System.Drawing.SystemIcons.Application;
            ni.Text = "Программа перезапуска КММ с пульта";
            ni.Visible = true;
            ni.DoubleClick +=
                delegate(object sender, EventArgs args)
                {
                    this.Show();
                    this.WindowState = WindowState.Normal;
                };
            System.Windows.Forms.ContextMenu contextMenu1 = new System.Windows.Forms.ContextMenu();
            System.Windows.Forms.MenuItem menuItem1 = new System.Windows.Forms.MenuItem();
            System.Windows.Forms.MenuItem menuItem2 = new System.Windows.Forms.MenuItem();

            // Initialize contextMenu1
            contextMenu1.MenuItems.AddRange(
                         new System.Windows.Forms.MenuItem[] { menuItem1, menuItem2 });

            // Initialize menuItem1
            menuItem1.Index = 1;
            menuItem1.Text = "Выход";
            menuItem1.Click += new System.EventHandler(menuItem1_Click);
            menuItem2.Index = 0;
            menuItem2.Text = "Открыть";
            menuItem2.Click += new System.EventHandler(menuItem2_Click);

            ni.ContextMenu = contextMenu1;
            this.Hide();

            serialPort = new SerialPort();
            serialPort.DataReceived += serialPort_DataReceived;
            serialPort.PortName = Settings.Default.ComPortNameSetting;
            path1 = Settings.Default.Path1;
            nameexe1 = Settings.Default.NameExe1;

            try
            {
                serialPort.Open();
            }
            catch (Exception)
            {
                MessageBox.Show("Не открывается порт " + Settings.Default.ComPortNameSetting + ".\nВыберите COM порт.");
            }
        }
开发者ID:iukash,项目名称:IRrecv,代码行数:48,代码来源:MainWindow.xaml.cs


示例19: Window1

 public Window1(Border toastBorder,System.Windows.Forms.MenuItem miShowVB, MainWindow.Toast toast)
 {
     this.miShowVB = miShowVB;
     InitializeComponent();
     rect1.Fill = new VisualBrush() { Visual = toastBorder};
     timer.Tick += (s, e) =>
       {
         txtIsPopupCycleRunning.Text = MKTwitch.IsPopupCycleRunning ? "true" : "false";
         if(MKTwitch.MKTwitchTimer!=null)
             txtMKTwitchTimerEnabled.Text = MKTwitch.MKTwitchTimer.IsEnabled ? "true" : "false";
           txtTopPos.Text = toast.TopPosition.ToString();
           txtBottomPos.Text = toast.BottomPosition.ToString();
           txtLeftPos.Text = toast.LeftPosition.ToString();
           txtLastUpdate.Text = MKTwitch.LastPull.ToLongTimeString();
       };
     timer.Start();
 }
开发者ID:mk1234444,项目名称:TwitchAlert,代码行数:17,代码来源:Window1.xaml.cs


示例20: OnStartup

        private void OnStartup(object sender, StartupEventArgs e)
        {
            // Create the notification icon
            m_NotifyIcon = new System.Windows.Forms.NotifyIcon();
            m_NotifyIcon.Icon = PerformantServer.Properties.Resources.DisconnectedIcon;
            m_NotifyIcon.Text = PerformantServer.Properties.Resources.DisconnectedTooltip;
            m_NotifyIcon.Visible = true;

            // Make menu
            System.Windows.Forms.MenuItem menuItem = new System.Windows.Forms.MenuItem("&Quit");
            menuItem.Click += Quit_Click;
            m_NotifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(new System.Windows.Forms.MenuItem[] { menuItem });

            // Start the server
            m_Server = new Server();
            m_Server.ConnectionChanged += Server_ConnectionChanged;
            m_Server.Start();
        }
开发者ID:spinglass,项目名称:Performant,代码行数:18,代码来源:App.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.MenuStrip类代码示例发布时间:2022-05-24
下一篇:
C# Forms.MainMenu类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap