Inheritance: ToolStripDropDownMenu
Exemplo n.º 1
1
        /// <summary>
        /// Build up the Tree for the current piece of Cyberware and all of its children.
        /// </summary>
        /// <param name="objCyberware">Cyberware to iterate through.</param>
        /// <param name="objParentNode">TreeNode to append to.</param>
        /// <param name="objMenu">ContextMenuStrip that the new Cyberware TreeNodes should use.</param>
        /// <param name="objGearMenu">ContextMenuStrip that the new Gear TreeNodes should use.</param>
        public void BuildCyberwareTree(Cyberware objCyberware, TreeNode objParentNode, ContextMenuStrip objMenu, ContextMenuStrip objGearMenu)
        {
            TreeNode objNode = new TreeNode();
                objNode.Text = objCyberware.DisplayName;
                objNode.Tag = objCyberware.InternalId;
                if (objCyberware.Notes != string.Empty)
                    objNode.ForeColor = Color.SaddleBrown;
                objNode.ToolTipText = objCyberware.Notes;
                objNode.ContextMenuStrip = objMenu;

                objParentNode.Nodes.Add(objNode);
                objParentNode.Expand();

                foreach (Cyberware objChild in objCyberware.Children)
                    BuildCyberwareTree(objChild, objNode, objMenu, objGearMenu);

                foreach (Gear objGear in objCyberware.Gear)
                {
                    TreeNode objGearNode = new TreeNode();
                    objGearNode.Text = objGear.DisplayName;
                    objGearNode.Tag = objGear.InternalId;
                    if (objGear.Notes != string.Empty)
                        objGearNode.ForeColor = Color.SaddleBrown;
                    objGearNode.ToolTipText = objGear.Notes;
                    objGearNode.ContextMenuStrip = objGearMenu;

                    BuildGearTree(objGear, objGearNode, objGearMenu);

                    objNode.Nodes.Add(objGearNode);
                    objNode.Expand();
                }
        }
Exemplo n.º 2
0
        public SysTrayContext()
        {
            container = new System.ComponentModel.Container();

              notifyIcon = new NotifyIcon(this.container);
              notifyIcon.Icon = forever.icon;

              notifyIcon.Text = "Forever";
              notifyIcon.Visible = true;

              //Instantiate the context menu and items
              contextMenu = new ContextMenuStrip();
              menuItemExit = new ToolStripMenuItem();

              //Attach the menu to the notify icon
              notifyIcon.ContextMenuStrip = contextMenu;

              menuItemExit.Text = "Exit";
              menuItemExit.Click += new EventHandler(menuItemExit_Click);
              contextMenu.Items.Add(menuItemExit);

              timer = new Timer(this.container);
              timer.Interval = 1000;
              timer.Tick += new EventHandler(timer_Tick);
              timer.Start();
        }
Exemplo n.º 3
0
 public ContextMenuStrip CreateContextMenu()
 {
     ContextMenuStrip menu = new ContextMenuStrip();
     ToolStripItem itemAdd = menu.Items.Add(Strings.Localize("Add..."));
     itemAdd.Click += new EventHandler(OnAddIPRange);
     return menu;
 }
Exemplo n.º 4
0
        public MapViewControl(frmMain Owner)
        {
            _Owner = Owner;

            InitializeComponent();

            ListSelect = new ContextMenuStrip();
            ListSelect.ItemClicked += ListSelect_Click;
            ListSelect.Closed += ListSelect_Close;
            UndoMessageTimer = new Timer();
            UndoMessageTimer.Tick += RemoveUndoMessage;

            OpenGLControl = Program.OpenGL1;
            pnlDraw.Controls.Add(OpenGLControl);

            GLInitializeDelayTimer = new Timer();
            GLInitializeDelayTimer.Interval = 50;
            GLInitializeDelayTimer.Tick += GLInitialize;
            GLInitializeDelayTimer.Enabled = true;

            tmrDraw = new Timer();
            tmrDraw.Tick += tmrDraw_Tick;
            tmrDraw.Interval = 1;

            tmrDrawDelay = new Timer();
            tmrDrawDelay.Tick += tmrDrawDelay_Tick;
            tmrDrawDelay.Interval = 30;

            UndoMessageTimer.Interval = 4000;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Read a streams file adding submenus and items to a context menu.
        /// </summary>
        /// <param name="filepath">Path to the streams file to read lines from.</param>
        /// <param name="menu">Target context menu.</param>
        /// <param name="onClick">Click event to attach to menu items.</param>
        public void Read(String filepath, ContextMenuStrip menu, EventHandler onClick)
        {
            this.filepath = filepath;
            this.menu = menu;
            this.onClick = onClick;

            try
            {
                // start at the menu root:
                currentMenuItemCollection = menu.Items;

                foreach (String line in File.ReadLines(filepath))
                {
                    currentLineNumber++;
                    currentLine = line;
                    ReadLine(line);
                }

                // add pending items for the last submenu:
                AddCurrentMenuItems();
            }
            finally
            {
                ResetState();
            }
        }
Exemplo n.º 6
0
        public static void BuildTreeView(TreeNode node, string dir, Project project, ContextMenuStrip synthDirAndFileMenu)
        {
            DirectoryInfo dInfo = new DirectoryInfo(dir);

            //Loop through the subdirs
            foreach (DirectoryInfo directory in dInfo.GetDirectories())
            {
                TreeNode t = new TreeNode(directory.Name);
                Regex synDirRegEx = new Regex(@"\d+_{1}");
                bool synDirMatch = synDirRegEx.IsMatch(directory.Name);
                if (synDirMatch)
                {
                    Console.WriteLine("Building TreeView, found a syn dir match " + directory.Name);
                    t.Tag = new SynthesisDirectory(directory.FullName, project);
                    t.ContextMenuStrip = synthDirAndFileMenu;
                }
                t.Name = directory.FullName;

                BuildTreeView(t, directory.FullName, project, synthDirAndFileMenu);
                node.Nodes.Add(t);
            }
            foreach (FileInfo file in dInfo.GetFiles())
            {
                TreeNode t = new TreeNode(file.Name);
                t.Name = file.FullName;
                t.ContextMenuStrip = synthDirAndFileMenu;
                t.Tag = project.FindSynthesis(Path.GetFileNameWithoutExtension(file.FullName));
                node.Nodes.Add(t);
            }
        }
Exemplo n.º 7
0
        public ContextMenuStrip GetDefaultMenu()
        {
            ContextMenuStrip menu = new ContextMenuStrip();

            ToolStripMenuItem openSettingsItem = new ToolStripMenuItem();
            openSettingsItem.Text = "Settings...";
            openSettingsItem.Click += SettingsClick;
            menu.Items.Add(openSettingsItem);

            ToolStripMenuItem pauseItem = new ToolStripMenuItem();
            pauseItem.Text = "Pause";
            pauseItem.Click += PauseProgram;
            menu.Items.Add(pauseItem);

            ToolStripMenuItem resumeItem = new ToolStripMenuItem();
            resumeItem.Text = "Resume";
            resumeItem.Click += ResumeProgram;
            menu.Items.Add(resumeItem);

            menu.Items.Add("-");

            ToolStripMenuItem exitItem = new ToolStripMenuItem();
            exitItem.Text = "Exit";
            exitItem.Click += new EventHandler(ExitClick);
            menu.Items.Add(exitItem);

            return menu;
        }
        internal ObedienceContext()
        {
            //Instantiate the component Module to hold everything
            _components = new System.ComponentModel.Container();
            Trace.Listeners.Add(new TextWriterTraceListener("C:\\temp\\Obedience.log"));
            
            //Instantiate the NotifyIcon attaching it to the components container and 
            //provide it an icon, note, you can imbed this resource 
            _notifyIcon = new NotifyIcon(_components);
            _notifyIcon.Icon = Resources.AppIcon;
            _notifyIcon.Text = "Obedience";
            _notifyIcon.Visible = true;

            //Instantiate the context menu and items
            var contextMenu = new ContextMenuStrip();
            var displayForm = new ToolStripMenuItem();
            var exitApplication = new ToolStripMenuItem();

            //Attach the menu to the notify icon
            _notifyIcon.ContextMenuStrip = contextMenu;

            //Setup the items and add them to the menu strip, adding handlers to be created later
            displayForm.Text = "Do something";
            displayForm.Click += mDisplayForm_Click;
            contextMenu.Items.Add(displayForm);

            exitApplication.Text = "Exit";
            exitApplication.Click += mExitApplication_Click;
            contextMenu.Items.Add(exitApplication);
            Trace.WriteLine("Obedience started");
            scanner = new AcdController(new IPEndPoint(new IPAddress(new byte[] {10, 0, 3, 220}), 5003));
            //scanner.Reboot();
            Trace.AutoFlush = true;
            scanner.ConnectedChanged += new ConnectedChangedEventHandler(scanner_ConnectedChanged);
        }
Exemplo n.º 9
0
        private static ContextMenuStrip Construct()
        {
            ContextMenuStrip ctx = new ContextMenuStrip();

            // Clone the image list in order to prevent event handlers
            // from the global client icons list to the context menu
            ctx.ImageList = UIUtil.CloneImageList(Program.MainForm.ClientIcons, true);

            bool bAppendSeparator = false;
            foreach(PwDocument ds in Program.MainForm.DocumentManager.Documents)
            {
                if(ds.Database.IsOpen)
                {
                    if(bAppendSeparator)
                        ctx.Items.Add(new ToolStripSeparator());

                    foreach(PwGroup pg in ds.Database.RootGroup.Groups)
                    {
                        ToolStripMenuItem tsmi = MenuCreateGroup(ds, pg);
                        ctx.Items.Add(tsmi);
                        MenuProcessGroup(ds, tsmi, pg);
                    }

                    bAppendSeparator = true;
                }
            }

            GlobalWindowManager.CustomizeControl(ctx);
            return ctx;
        }
        public ListGroup()
            : base()
        {
            defaultContextMenuStrip = new ContextMenuStrip();
            defaultContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(regularListViewMenu_Opening);
            this.ContextMenuStrip = defaultContextMenuStrip;

            _Columns = new ListGroupColumnCollection(this);
            _Items = new ListGroupItemCollection(this);

            // The Imagelist is used to hold images for the expanded and contracted icons in the
            // Left-most columnheader:
            this.SmallImageList = new ImageList();

            // The tilting arrow images are available in the app resources:
            this.SmallImageList.Images.Add(COLLAPSED_IMAGE_KEY, Properties.Resources.CollapsedGroupSmall_png_1616);
            this.SmallImageList.Images.Add(EXPANDED_IMAGE_KEY, Properties.Resources.ExpandedGroupSmall_png_1616);
            this.SmallImageList.Images.Add(EMPTY_IMAGE_KEY, Properties.Resources.EmptyGroupSmall_png_1616);

            // The stateImageList is used as a hack method to allow larger Row Heights:
            this.StateImageList = new ImageList();

            // Default configuration (for this sample. Obviously, configure to fit your needs:
            this.View = System.Windows.Forms.View.Details;
            this.FullRowSelect = true;
            this.GridLines = true;
            this.LabelEdit = false;
            this.Margin = new Padding(0);
            this.SetAutoSizeMode(AutoSizeMode.GrowAndShrink);
            this.MaximumSize = new System.Drawing.Size(1000, 300);

            // Subscribe to local Events:
            this.ColumnClick += new ColumnClickEventHandler(ListGroup_ColumnClick);
        }
Exemplo n.º 11
0
        public TaskBarIconMenu()
        {
            TrayIcon_Menu = new ContextMenuStrip();
            TrayIcon_Artist = new ToolStripLabel();
            TrayIcon_Title = new ToolStripLabel();
            TrayIcon_Diff = new ToolStripLabel();
            TrayIcon_Play = new ToolStripMenuItem();
            TrayIcon_PlayNext = new ToolStripMenuItem();
            TrayIcon_PlayPrev = new ToolStripMenuItem();
            TrayIcon_Exit = new ToolStripMenuItem();
            TrayIcon_Menu.SuspendLayout();

            TrayIcon_Menu.Items.AddRange(new ToolStripItem[] {
                TrayIcon_Artist,
                TrayIcon_Title,
                TrayIcon_Diff,
                TrayIcon_Play,
                TrayIcon_PlayNext,
                TrayIcon_PlayPrev,
                TrayIcon_Exit});
            TrayIcon_Menu.Name = "TrayIcon_Menu";
            TrayIcon_Menu.Size = new Size(176, 176);
            // TrayIcon_Artist
            TrayIcon_Artist.Name = "TrayIcon_Artist";
            TrayIcon_Artist.Text = LanguageManager.Get("TrayIcon_Aritst_Text");
            TrayIcon_Artist.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 134);
            // TrayIcon_Title
            TrayIcon_Title.Name = "TrayIcon_Title";
            TrayIcon_Title.Text = LanguageManager.Get("TrayIcon_Title_Text");
            TrayIcon_Title.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 134);
            // TrayIcon_Diff
            TrayIcon_Diff.Name = "TrayIcon_Diff";
            TrayIcon_Diff.Text = LanguageManager.Get("TrayIcon_Diff_Text");
            TrayIcon_Diff.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 134);
            // TrayIcon_Play
            TrayIcon_Play.Name = "TrayIcon_Play";
            TrayIcon_Play.Text = LanguageManager.Get("TrayIcon_Play_Pause_Text");
            TrayIcon_Play.Click += delegate { SendKeys.Send("%{F5}"); };
            // TrayIcon_PlayNext
            TrayIcon_PlayNext.Name = "TrayIcon_PlayNext";
            TrayIcon_PlayNext.Text = LanguageManager.Get("TrayIcon_PlayNext_Text");
            TrayIcon_PlayNext.Click += delegate { SendKeys.Send("%{RIGHT}"); };
            // TrayIcon_PlayNext
            TrayIcon_PlayPrev.Name = "TrayIcon_PlayPrev";
            TrayIcon_PlayPrev.Text = LanguageManager.Get("TrayIcon_PlayPrev_Text");
            TrayIcon_PlayPrev.Click += delegate { SendKeys.Send("%{LEFT}"); };
            // TrayIcon_Exit
            TrayIcon_Exit.Name = "TrayIcon_Exit";
            TrayIcon_Exit.Text = LanguageManager.Get("TrayIcon_Exit_Text");
            TrayIcon_Exit.Click += delegate
            {
                if (
                    MessageBox.Show(LanguageManager.Get("Comfirm_Exit_Text"), LanguageManager.Get("Tip_Text"),
                        MessageBoxButtons.YesNo) != DialogResult.Yes) return;
                Core.MainIsVisible = false;
                Core.Exit();
                Environment.Exit(0);
            };
            TrayIcon_Menu.ResumeLayout(false);
        }
 public void BuildContextMenu(ContextMenuStrip contextMenuStrip)
 {
     contextMenuStrip.Items.Clear();
     contextMenuStrip.Items.AddRange(switchEvents
         .OrderBy(project => project.Name)
         .Select(CreateSubMenu).ToArray());
 }
Exemplo n.º 13
0
        public static void Show(int iPosX, int iPosY)
        {
            EntryMenu.Destroy();

            m_ctx = EntryMenu.Construct();
            m_ctx.Show(iPosX, iPosY);
        }
        public void InitializeTrayIconAndProperties()
        {
            serviceStatus = _serviceManager.GetServiceStatus();

            //Set the Tray icon
            if (serviceStatus == ServiceControllerStatus.Running)
                notifyTrayIcon.Icon = Properties.Resources.TrayIconRunning;
            else if (serviceStatus == ServiceControllerStatus.Stopped)
                notifyTrayIcon.Icon = Properties.Resources.TrayIconStopped;
            else
                notifyTrayIcon.Icon = Properties.Resources.TrayIconActive;

            //Setup context menu options
            trayContextMenu = new ContextMenuStrip();
            trayContextMenu.Items.Add(new ToolStripMenuItem() { Name = ActionConstants.REFRESH, Text = "Refresh Status" });
            trayContextMenu.Items.Add("-");

            _startServiceItem = new ToolStripMenuItem() { Enabled = ServiceControllerStatus.Stopped.Equals(serviceStatus), Name = ActionConstants.START_SERVICE, Text = "Start Service" };
            trayContextMenu.Items.Add(_startServiceItem);

            _stopServiceItem = new ToolStripMenuItem() { Enabled = ServiceControllerStatus.Running.Equals(serviceStatus), Name = ActionConstants.STOP_SERVICE, Text = "Stop Service" };
            trayContextMenu.Items.Add(_stopServiceItem);

            trayContextMenu.Items.Add("-");
            trayContextMenu.Items.Add(new ToolStripMenuItem() { Name = ActionConstants.SHOW_LOGS, Text = "Show Logs" });
            trayContextMenu.Items.Add("-");

            trayContextMenu.Items.Add(new ToolStripMenuItem() { Name = "actionExit", Text = "Exit" });

            trayContextMenu.ItemClicked += trayContextMenu_ItemClicked;

            //Initialize the tray icon here
            this.notifyTrayIcon.ContextMenuStrip = trayContextMenu;
        }
Exemplo n.º 15
0
        /// <summary>
        /// Creates this instance.
        /// </summary>
        /// <returns>ContextMenuStrip</returns>
        public ContextMenuStrip Create()
        {
            // Add the default menu options.
            ContextMenuStrip menu = new ContextMenuStrip();
            ToolStripMenuItem item;
            ToolStripSeparator sep;

            this._textmodeItem = new ToolStripMenuItem();

            this._textmodeItem.Text = "Text mode";
            this._textmodeItem.Enabled = false;
            menu.Items.Add(this._textmodeItem);

            this.SetTextModeText(BopomofoRegistry.IsSimplifiedEnable(), false);

            // About.
            item = new ToolStripMenuItem();
            item.Text = "About";
            item.Click += new EventHandler(this.About_Click);
            menu.Items.Add(item);

            // Separator.
            sep = new ToolStripSeparator();
            menu.Items.Add(sep);

            // Exit.
            item = new ToolStripMenuItem();
            item.Text = "Exit";
            item.Click += new System.EventHandler(this.Exit_Click);
            menu.Items.Add(item);

            return menu;
        }
        /// <summary>
        /// Is the About box displayed?
        /// </summary>
        //bool isAboutLoaded = false;
        /// <summary>
        /// Creates this instance.
        /// </summary>
        /// <returns>ContextMenuStrip</returns>
        public ContextMenuStrip Create()
        {
            // Add the default menu options.
            ContextMenuStrip menu = new ContextMenuStrip();
            ToolStripMenuItem item;
            //ToolStripSeparator sep;

            // Windows Explorer.
            item = new ToolStripMenuItem();
            item.Text = "Submit Ticket";
            item.Click += new EventHandler(Explorer_Click);
            item.Image = Resources.Explorer;
            menu.Items.Add(item);

            //Printer
            item = new ToolStripMenuItem();
            item.Text = "Manage Printers";
            item.Click += new EventHandler(Print_Click);
            item.Image = Resources.Exit;
            menu.Items.Add(item);

            // About.
            item = new ToolStripMenuItem();
            item.Text = "About";
            item.Click += new EventHandler(About_Click);
            item.Image = Resources.About;
            menu.Items.Add(item);

            // Separator.
            //sep = new ToolStripSeparator();
            //menu.Items.Add(sep);

            return menu;
        }
Exemplo n.º 17
0
 private void addScreenToMenu(ContextMenuStrip mnuStrip, ScreenBase screen, string title)
 {
     ToolStripMenuItem m = new ToolStripMenuItem(title);
     m.Tag = screen;
     m.Click += new EventHandler(mnuMoveItemScreen_Click);
     mnuStrip.Items.Add(m);
 }
Exemplo n.º 18
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="NotifyIconController" /> class.
        /// </summary>
        /// <param name="application">The application.</param>
        public NotifyIconController(GacApplication application)
        {
            _application = application;
            _notifyIcon = new NotifyIcon();
            var contextMenu = new ContextMenuStrip();
            contextMenu.Items.AddRange(
                new ToolStripItem[]
                {
                    new ToolStripMenuItem(Resources.NotifyIconController_NotifyIconController_About, null, (s, e) => ShowAbout()),
                    new ToolStripSeparator(),
                    new ToolStripMenuItem(Resources.NotifyIconController_NotifyIconController_Configuration, null,
                        (s, e) => ShowMainForm()),
                    new ToolStripMenuItem(Resources.NotifyIconController_NotifyIconController_Exit, null,
                        (s, e) => Close())
                }
                );

            _notifyIcon.ContextMenuStrip = contextMenu;
            _notifyIcon.Icon = Resources.icon_16;
            _notifyIcon.Text = Resources.AppName;

            _notifyIcon.DoubleClick += delegate { ShowMainForm(); };

            if (!application.IsCommandLineDriven && application.Tasks.Count == 0)
            {
                ShowMainForm();
            }
        }
Exemplo n.º 19
0
 public MainForm(DeviceGrapher aDeviceGrapher)
 {
     iDeviceGrapher = aDeviceGrapher;
     iContextMenu = new ContextMenuStrip();
     iDeviceGrapher.ContextMenu = iContextMenu;
     InitializeComponent();
 }
Exemplo n.º 20
0
        private static ContextMenuStrip Construct()
        {
            ContextMenuStrip ctx = new ContextMenuStrip();

            ctx.ImageList = Program.MainForm.ClientIcons;

            bool bAppendSeparator = false;
            foreach(PwDocument ds in Program.MainForm.DocumentManager.Documents)
            {
                if(ds.Database.IsOpen)
                {
                    if(bAppendSeparator)
                        ctx.Items.Add(new ToolStripSeparator());

                    foreach(PwGroup pg in ds.Database.RootGroup.Groups)
                    {
                        ToolStripMenuItem tsmi = MenuCreateGroup(ds, pg);
                        ctx.Items.Add(tsmi);
                        MenuProcessGroup(ds, tsmi, pg);
                    }

                    bAppendSeparator = true;
                }
            }

            GlobalWindowManager.CustomizeControl(ctx);
            return ctx;
        }
Exemplo n.º 21
0
 static ARCWrapper()
 {
     _menu = new ContextMenuStrip();
     _menu.Items.Add(new ToolStripMenuItem("Ne&w", null,
         new ToolStripMenuItem("ARChive", null, NewARCAction),
         new ToolStripMenuItem("BRResource Pack", null, NewBRESAction),
         new ToolStripMenuItem("MSBin", null, NewMSBinAction)
         ));
     _menu.Items.Add(new ToolStripMenuItem("&Import", null,
         new ToolStripMenuItem("ARChive", null, ImportARCAction),
         new ToolStripMenuItem("BRResource Pack", null, ImportBRESAction),
         new ToolStripMenuItem("MSBin", null, ImportMSBinAction)
         ));
     _menu.Items.Add(new ToolStripSeparator());
     _menu.Items.Add(new ToolStripMenuItem("Preview All Models", null, PreviewAllAction));
     _menu.Items.Add(new ToolStripMenuItem("Export All", null, ExportAllAction));
     _menu.Items.Add(new ToolStripMenuItem("Replace All", null, ReplaceAllAction));
     _menu.Items.Add(new ToolStripSeparator());
     _menu.Items.Add(new ToolStripMenuItem("&Export", null, ExportAction, Keys.Control | Keys.E));
     _menu.Items.Add(new ToolStripMenuItem("&Replace", null, ReplaceAction, Keys.Control | Keys.R));
     _menu.Items.Add(new ToolStripMenuItem("Res&tore", null, RestoreAction, Keys.Control | Keys.T));
     _menu.Items.Add(new ToolStripSeparator());
     _menu.Items.Add(new ToolStripMenuItem("Move &Up", null, MoveUpAction, Keys.Control | Keys.Up));
     _menu.Items.Add(new ToolStripMenuItem("Move D&own", null, MoveDownAction, Keys.Control | Keys.Down));
     _menu.Items.Add(new ToolStripMenuItem("Re&name", null, RenameAction, Keys.Control | Keys.N));
     _menu.Items.Add(new ToolStripSeparator());
     _menu.Items.Add(new ToolStripMenuItem("&Delete", null, DeleteAction, Keys.Control | Keys.Delete));
     _menu.Opening += MenuOpening;
     _menu.Closing += MenuClosing;
 }
Exemplo n.º 22
0
        // minimal Clone implementation for DGV support only.
        internal ContextMenuStrip Clone() {

           // VERY limited support for cloning.  
           
           ContextMenuStrip contextMenuStrip = new ContextMenuStrip();

           // copy over events
           contextMenuStrip.Events.AddHandlers(this.Events);

           contextMenuStrip.AutoClose = AutoClose;
           contextMenuStrip.AutoSize = AutoSize;
           contextMenuStrip.Bounds = Bounds;
           contextMenuStrip.ImageList = ImageList;
           contextMenuStrip.ShowCheckMargin = ShowCheckMargin;
           contextMenuStrip.ShowImageMargin = ShowImageMargin;
           

           // copy over relevant properties

           for (int i = 0; i < Items.Count; i++) {
              ToolStripItem item = Items[i];
              
              if (item is ToolStripSeparator) {
                contextMenuStrip.Items.Add(new ToolStripSeparator());
              }
              else if (item is ToolStripMenuItem) {
                ToolStripMenuItem menuItem = item as ToolStripMenuItem;
                contextMenuStrip.Items.Add(menuItem.Clone());
              }

           }
           return contextMenuStrip;
        }
Exemplo n.º 23
0
		public static ContextMenuStrip CreateContextMenu(object owner, string addInTreePath)
		{
			if (addInTreePath == null) {
				return null;
			}
			try {
				ArrayList buildItems = AddInTree.GetTreeNode(addInTreePath).BuildChildItems(owner);
				ContextMenuStrip contextMenu = new ContextMenuStrip();
				contextMenu.Items.Add(new ToolStripMenuItem("dummy"));
				contextMenu.Opening += delegate {
					contextMenu.Items.Clear();
					foreach (object item in buildItems) {
						if (item is ToolStripItem) {
							contextMenu.Items.Add((ToolStripItem)item);
						} else {
							ISubmenuBuilder submenuBuilder = (ISubmenuBuilder)item;
							contextMenu.Items.AddRange(submenuBuilder.BuildSubmenu(null, owner));
						}
					}
				};
				contextMenu.Opened += ContextMenuOpened;
				contextMenu.Closed += ContextMenuClosed;
				return contextMenu;
			} catch (TreePathNotFoundException) {
				MessageService.ShowError("Warning tree path '" + addInTreePath +"' not found.");
				return null;
			}
		}
Exemplo n.º 24
0
        private void Install()
        {
            _contextMenu = new ContextMenuStrip();
            _contextMenu.Items.AddRange(new ToolStripItem[] {
                new ToolStripMenuItem(Strings.MenuOpen, Resources.icon, TaskIconOpen_click) {
                    ToolTipText = Strings.MenuOpenTT,
                },
                new ToolStripMenuItem(Strings.MenuWindows, Resources.list){
                    DropDown = Form.MenuWindows,
                    ToolTipText = Strings.MenuWindowsTT
                },
                new ToolStripMenuItem(Strings.MenuReset, null, TaskIconReset_click){
                    ToolTipText = Strings.MenuResetTT
                },
                new ToolStripMenuItem(Strings.MenuClose, Resources.close_new, TaskIconExit_click){
                    ToolTipText = Strings.MenuCloseTT
                }
            });
            Asztal.Szótár.NativeToolStripRenderer.SetToolStripRenderer(_contextMenu);

            _taskIcon = new NotifyIcon {
                Text = Strings.ApplicationName,
                Icon = Resources.new_flat_icon,
                Visible = true,
                ContextMenuStrip = _contextMenu
            };
            _taskIcon.DoubleClick += new EventHandler(TaskIcon_doubleclick);
        }
Exemplo n.º 25
0
        public ContextMenuStrip Create()
        {
            // Add the default menu options.
              ContextMenuStrip menu = new ContextMenuStrip();
              ToolStripMenuItem item;
              ToolStripSeparator sep;

              // Name
              item = new ToolStripMenuItem();
              item.Text = "SimplePTT 1.1";
              item.Enabled = false;
              menu.Items.Add(item);

              // Separator
              sep = new ToolStripSeparator();
              menu.Items.Add(sep);

              // Exit
              item = new ToolStripMenuItem();
              item.Text = "Exit";
              item.Click += new System.EventHandler(Exit_Click);
              menu.Items.Add(item);

              return menu;
        }
		/// <summary>
		/// 构造 NotifyIconHelper 的新实例。
		/// </summary>
		/// <param name="mainForm">应用程序主窗体。</param>
		/// <param name="notHandleClosingEvent">是否不让 NotifyIconHelper 处理主窗体的 FormClosing 事件。
		/// <remarks>
		/// 缺省情况下此参数应为 False,即 NotifyIconHelper 总是通过处理主窗体的 FormClosing 事件达到让主窗体在关闭后
		/// 驻留系统托盘区的目的。但特殊情况下,应用程序可能会自己处理主窗体的的 FormClosing 事件,此时应设置此属性为 True。
		/// </remarks>
		/// </param>
		/// <param name="showPromptWhenClosing">是否在窗体关闭时给用户以提示,仅当 NotHandleClosingEvent = False 时有效。</param>
		public NotifyIconHelper( Form mainForm, bool notHandleClosingEvent, bool showPromptWhenClosing )
		{
			_mainForm = mainForm;
			_showPromptWhenClosing = showPromptWhenClosing;

			_imgLst = new ImageList();
			_imgLst.Images.Add( _mainForm.Icon );

			Image img = Image.FromHbitmap( _mainForm.Icon.ToBitmap().GetHbitmap() );

			_contextMenu = new ContextMenuStrip();

			_contextMenu.Items.Add( new ToolStripMenuItem( Resources.MenuShowMainForm, img, OnShowMainForm ) );
			_contextMenu.Items.Add( new ToolStripSeparator() );
			_contextMenu.Items.Add( new ToolStripMenuItem( Resources.MenuExit, null, OnExitApp ) );

			_notifyIcon = new NotifyIcon();
			_notifyIcon.Icon = GetAppIcon();
			_notifyIcon.Text = _mainForm.Text;
			_notifyIcon.Visible = true;
			_notifyIcon.ContextMenuStrip = _contextMenu;
			_notifyIcon.MouseDown += _notifyIcon_MouseDown;

			_mainForm.FormClosed += _mainForm_FormClosed;

			if( notHandleClosingEvent == false )
				_mainForm.FormClosing += new FormClosingEventHandler( _mainForm_FormClosing );
		}
        public TweakExecuteControl(Tweakable tweakable, string currentState)
            : base()
        {
            this.tweakable = tweakable;
            this.state = currentState;
            this.Padding = new Padding(0, 0, 7, 0);

            Text = "execute";

            menu = new ContextMenuStrip();
            menu.ShowCheckMargin = false;
            menu.ShowImageMargin = false;
            menu.ShowItemToolTips = false;

            foreach (string setting in tweakable.GetAvailableSettings())
            {
                ToolStripItem item = new ToolStripButton(setting);
                if (setting == currentState)
                {
                    item.Enabled = false;
                }

                item.Click += Item_Click;

                menu.Items.Add(item);
            }
        }
Exemplo n.º 28
0
        protected override ContextMenuStrip CreateMenu() {
            var client = Novaroma.Helper.CreateShellServiceClient();
            Helper.SetCulture(client);

            var path = SelectedItemPaths.First();
            
            var menu = new ContextMenuStrip();
            var menuRoot = new ToolStripMenuItem {
                Text = Constants.Novaroma,
                Image = Resources.Img_Logo_16x16
            };

            var downloadable = client.GetDownloadable(path).Result;
            if (downloadable != null) {
                var updateWatchStatus = new ToolStripMenuItem {
                    Text = Resources.IsWatched,
                    Image = Resources.Img_Watch_16x16,
                    Checked = downloadable.IsWatched
                };
                updateWatchStatus.Click += (sender, args) => UpdateWatchStatus(path, !downloadable.IsWatched);
                menuRoot.DropDownItems.Add(updateWatchStatus);
            }

            var downloadSubtitle = new ToolStripMenuItem {
                Text = Resources.DownloadSubtitle,
                Image = Resources.Img_DownloadSubtitle_16x16
            };
            downloadSubtitle.Click += (sender, args) => DownloadSubtitle(path);
            menuRoot.DropDownItems.Add(downloadSubtitle);

            menu.Items.Add(menuRoot);
            return menu;
        }
Exemplo n.º 29
0
		void InterlinDocForAnalysis_RightMouseClickedEvent(SimpleRootSite sender, FwRightMouseClickEventArgs e)
		{
			e.EventHandled = true;
			// for the moment we always claim to have handled it.
			ContextMenuStrip menu = new ContextMenuStrip();

			// Add spelling items if any (i.e., if we clicked a squiggle word).
			int hvoObj, tagAnchor;
			if (GetTagAndObjForOnePropSelection(e.Selection, out hvoObj, out tagAnchor) &&
				(tagAnchor == SegmentTags.kflidFreeTranslation || tagAnchor == SegmentTags.kflidLiteralTranslation ||
				tagAnchor == NoteTags.kflidContent))
			{
				var helper = new SpellCheckHelper(Cache);
				helper.MakeSpellCheckMenuOptions(e.MouseLocation, this, menu);
			}

			int hvoNote;
			if (CanDeleteNote(e.Selection, out hvoNote))
			{
				if (menu.Items.Count > 0)
				{
					menu.Items.Add(new ToolStripSeparator());
				}
				// Add the delete item.
				string sMenuText = ITextStrings.ksDeleteNote;
				ToolStripMenuItem item = new ToolStripMenuItem(sMenuText);
				item.Click += OnDeleteNote;
				menu.Items.Add(item);
			}
			if (menu.Items.Count > 0)
			{
				e.Selection.Install();
				menu.Show(this, e.MouseLocation);
			}
		}
        public SimulationModeItemManager(ContextMenuStrip contextMenuStrip, CarModelGraphicControl graphicControl)
        {
            model = new CarModel(new CarModelState(new PointD(ComMath.Normal(0, 0, 1, CarModelState.MIN_POS_X, CarModelState.MAX_POS_X),
                                                             ComMath.Normal(0, 0, 1, CarModelState.MIN_POS_Y, CarModelState.MAX_POS_Y)),
                                                  new PointD(0, 1)));
            finish = new FinishModel(new PointD(ComMath.Normal(0.5, 0, 1, CarModelState.MIN_POS_X, CarModelState.MAX_POS_X),
                                                ComMath.Normal(0.5, 0, 1, CarModelState.MIN_POS_Y, CarModelState.MAX_POS_Y)),
                                     0);
            obstacles = new List<ObstacleModel>();
            dragables = new List<IDragable>();

            sampledCarState = model.state;
            
            dragables.Add(model);
            dragables.Add(finish);
            dragged = null;

            state = State.NONE;

            this.contextMenuStrip = contextMenuStrip;
            this.graphicControl = graphicControl;

            contextMenuStrip.Items[0].Click += new EventHandler(newObstacle);
            contextMenuStrip.Items[1].Click += new EventHandler(deleteObstacle);
        }
Exemplo n.º 31
0
 /// <summary>
 /// Called when visibility of context menu is changed
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void cMS_MatchedGestures_VisibleChanged(object sender, EventArgs e)
 {
     System.Windows.Forms.ContextMenuStrip contextMenu = (System.Windows.Forms.ContextMenuStrip)sender;
     // when is not visible then close it
     if (!contextMenu.Visible)
     {
         //contextMenu.Close();
         m_contextMenuIsVisible = false;
     }
 }
Exemplo n.º 32
0
 public AutobusUnutra(List <Putnik> putnici, FlowLayoutPanel flowLayoutPanel1, Putnik putnik, string tmpMjesto, string tmpDatum, System.Windows.Forms.ContextMenuStrip contextMenuStrip1)
 {
     InitializeComponent();
     this.putnici           = putnici;
     this.flowLayoutPanel1  = flowLayoutPanel1;
     this.putnik            = putnik;
     this.tmpMjesto         = tmpMjesto;
     this.tmpDatum          = tmpDatum;
     this.contextMenuStrip1 = contextMenuStrip1;
 }
Exemplo n.º 33
0
 private void dataGridView1_MouseClick(object sender, MouseEventArgs e)//SAĞ TIK OLAYINI KONTROL ETME
 {
     if (e.Button == MouseButtons.Left)
     {
     }
     else
     {
         ContextMenuStrip menu = new System.Windows.Forms.ContextMenuStrip();
     }
 }
Exemplo n.º 34
0
 private void dataGridView1_MouseClick(object sender, MouseEventArgs e)//MOUSE UN CLICK BASARAK SAĞ CLICKSE AÇ YENİ KISMININ ÇIKMASI
 {
     if (e.Button == MouseButtons.Left)
     {
     }
     else
     {
         ContextMenuStrip menu = new System.Windows.Forms.ContextMenuStrip();
     }
 }
Exemplo n.º 35
0
        internal virtual System.Windows.Forms.ContextMenuStrip GetOvMenu()
        {
            System.Windows.Forms.ContextMenuStrip CM = new System.Windows.Forms.ContextMenuStrip();
            CM.Items.Add(new ToolStripTraceBarItem(Core, 2));
            CM.Items.Add(new ToolStripTraceBarItem(Core, 1));
            CM.Items.Add(new ToolStripTraceBarItem(Core, 0));
            CM.Width = 150;

            return(CM);
        }
Exemplo n.º 36
0
 public override bool HandleMouseDown(Point p)
 {
     CheckDisposed();
     System.Windows.Forms.ContextMenuStrip contextMenuStrip = SetupContextMenuStrip();
     if (contextMenuStrip.Items.Count > 0)
     {
         contextMenuStrip.Show(TreeNode, p);
     }
     return(true);
 }
Exemplo n.º 37
0
 public Systray(ParseArgs parser)
 {
     this.parser     = parser;
     this.components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Systray));
     this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
     this.notifyMenu  = new System.Windows.Forms.ContextMenuStrip(this.components);
     this.exit        = new System.Windows.Forms.ToolStripMenuItem();
     this.unmount     = new System.Windows.Forms.ToolStripMenuItem();
     this.mount       = new System.Windows.Forms.ToolStripMenuItem();
     this.notifyMenu.SuspendLayout();
     //
     // notifyIcon1
     //
     this.notifyIcon1.ContextMenuStrip = this.notifyMenu;
     this.notifyIcon1.Icon             = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
     this.notifyIcon1.Text             = "SSHFS";
     this.notifyIcon1.Visible          = true;
     //
     // notifyMenu
     //
     this.notifyMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.exit,
         this.unmount,
         this.mount
     });
     this.notifyMenu.Name            = "Exit";
     this.notifyMenu.ShowImageMargin = false;
     this.notifyMenu.Size            = new System.Drawing.Size(91, 70);
     //
     // exit
     //
     this.exit.Name   = "exit";
     this.exit.Size   = new System.Drawing.Size(90, 22);
     this.exit.Text   = "Exit";
     this.exit.Click += new System.EventHandler(this.exit_Click);
     //
     // unmount
     //
     this.unmount.Name    = "unmount";
     this.unmount.Size    = new System.Drawing.Size(90, 22);
     this.unmount.Text    = "Unmount";
     this.unmount.Visible = false;
     this.unmount.Click  += new System.EventHandler(this.unmount_Click);
     //
     // mount
     //
     this.mount.Name   = "mount";
     this.mount.Size   = new System.Drawing.Size(90, 22);
     this.mount.Text   = "Mount";
     this.mount.Click += new System.EventHandler(this.mount_Click);
     //
     this.notifyMenu.ResumeLayout(false);
     this.PerformLayout();
 }
Exemplo n.º 38
0
        public MainWindow()
        {
            this.DataContext = new MainWindowViewModel();
            using (var iconStream = Application
                                    .GetResourceStream(new Uri("pack://application:,,,/VirtualGameMode;component/Resources/icon.ico"))
                                    ?.Stream)
            {
                _trayIcon = new NotifyIcon()
                {
                    Visible = true,
                    Icon    = new System.Drawing.Icon(iconStream)
                };
            }
            _trayIcon.DoubleClick += TrayIcon_DoubleClick;
            var menuItemShow = new System.Windows.Forms.ToolStripMenuItem()
            {
                Name = "Show/Hide",
                Text = Settings.Default.StartMinimized ? "Show" : "Minimize to tray"
            };

            menuItemShow.Click += (sender, args) =>
            {
                if (this.IsVisible)
                {
                    WindowState = WindowState.Minimized;
                }
                else
                {
                    this.Show();
                    this.WindowState = WindowState.Normal;
                }
            };
            var menuItemExit = new System.Windows.Forms.ToolStripMenuItem()
            {
                Name = "Exit",
                Text = "Exit"
            };

            menuItemExit.Click += (sender, args) => Application.Current.Shutdown();
            var contextMenu = new System.Windows.Forms.ContextMenuStrip();

            contextMenu.Items.Add(menuItemShow);
            contextMenu.Items.Add("-");
            contextMenu.Items.Add(menuItemExit);
            _trayIcon.ContextMenuStrip = contextMenu;
            if (Settings.Default.StartMinimized)
            {
                Hide();
                WindowState = WindowState.Minimized;
            }
            _mini              = new MiniWindow();
            _mini.Deactivated += MiniOnDeactivated;
            _trayIcon.Click   += TrayIconOnClick;
            Loaded            += MainWindow_Loaded;
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     itemListLv_ = new System.Windows.Forms.ListView();
     popupMenu_  = new System.Windows.Forms.ContextMenuStrip();
     editMi_     = new System.Windows.Forms.ToolStripMenuItem();
     newMi_      = new System.Windows.Forms.ToolStripMenuItem();
     deleteMi_   = new System.Windows.Forms.ToolStripMenuItem();
     SuspendLayout();
     //
     // ItemListLV
     //
     itemListLv_.ContextMenuStrip = popupMenu_;
     itemListLv_.Dock             = System.Windows.Forms.DockStyle.Fill;
     itemListLv_.FullRowSelect    = true;
     itemListLv_.Name             = "itemListLv_";
     itemListLv_.Size             = new System.Drawing.Size(432, 272);
     itemListLv_.TabIndex         = 0;
     itemListLv_.View             = System.Windows.Forms.View.Details;
     itemListLv_.DoubleClick     += new System.EventHandler(EditMI_Click);
     //
     // PopupMenu
     //
     popupMenu_.Items.AddRange(new System.Windows.Forms.ToolStripMenuItem[] {
         editMi_,
         newMi_,
         deleteMi_
     });
     //
     // EditMI
     //
     editMi_.ImageIndex = 0;
     editMi_.Text       = "&Edit...";
     editMi_.Click     += new System.EventHandler(EditMI_Click);
     //
     // NewMI
     //
     newMi_.ImageIndex = 1;
     newMi_.Text       = "&New...";
     newMi_.Click     += new System.EventHandler(NewMI_Click);
     //
     // DeleteMI
     //
     deleteMi_.ImageIndex = 2;
     deleteMi_.Text       = "&Delete";
     deleteMi_.Click     += new System.EventHandler(RemoveMI_Click);
     //
     // ItemListEditCtrl
     //
     Controls.AddRange(new System.Windows.Forms.Control[] {
         itemListLv_
     });
     Name = "ItemListEditCtrl";
     Size = new System.Drawing.Size(432, 272);
     ResumeLayout(false);
 }
Exemplo n.º 40
0
        protected WinForms.ContextMenuStrip CreateTrayMenu()
        {
            var mnu = new WinForms.ContextMenuStrip();

            //mnu.RenderMode = WinForms.ToolStripRenderMode.Professional;

            mnu.Items.Add(
                WinFrmMenuAdapter.CreateMenuItem(
                    Strings.MNU_SHOW, _WorkItem.Commands.Activate));
            mnu.Items.Add(
                WinFrmMenuAdapter.CreateMenuItem(
                    Strings.MNU_HIDE, _WorkItem.Commands.Deactivate));

            mnu.Items.Add(             //-------
                new WinForms.ToolStripSeparator());

            mnu.Items.Add(
                WinFrmMenuAdapter.CreateMenuItem(
                    Strings.MNU_SETTINGS, _WorkItem.Commands.Settings));

            var tsmi = new System.Windows.Forms.ToolStripMenuItem(Strings.ALWAYS_ON_TOP);

            tsmi.Checked = _WorkItem.Settings.AlwaysOnTop;

            tsmi.Click += (s, e) =>
                          _WorkItem.Settings.AlwaysOnTop = !(s as System.Windows.Forms.ToolStripMenuItem).Checked;

            _WorkItem.Settings.PropertyChanged += delegate(object s, PropertyChangedEventArgs e)
            {
                if (e.PropertyName == "AlwaysOnTop" || e.PropertyName == "All")
                {
                    tsmi.Checked = _WorkItem.Settings.AlwaysOnTop;
                }
            };

            mnu.Items.Add(tsmi);

            mnu.Items.Add(
                WinFrmMenuAdapter.CreateMenuItem(
                    Strings.MNU_MANAGEAPP, _WorkItem.Commands.ManageApps));

            mnu.Items.Add(
                WinFrmMenuAdapter.CreateMenuItem(
                    CommStr.ABOUT + "...", _WorkItem.Commands.Help, true));

            mnu.Items.Add(             //-------
                new WinForms.ToolStripSeparator());

            mnu.Items.Add(
                WinFrmMenuAdapter.CreateMenuItem(
                    Strings.MNU_CLOSE, _WorkItem.Commands.Quit));

            return(mnu);
        }
Exemplo n.º 41
0
 /// <summary>
 /// 追加同目录下可执行文件到上下文菜单中
 /// 调用方法:new clsContextMenuStrip(this.FindForm());
 /// </summary>
 public clsContextMenuStrip(Form f)
 {
     form = f;
     menu = f.Controls.Owner.ContextMenuStrip;
     if (menu == null)
     {
         menu = new ContextMenuStrip();
         form.Controls.Owner.ContextMenuStrip = menu;
     }
     Init();
 }
Exemplo n.º 42
0
        private void listFiles_MouseClick(object sender, MouseEventArgs e)
        {
            if ((e.Button != MouseButtons.Right) ||
                (listFiles.SelectedItems.Count == 0))
            {
                return;
            }
            System.Windows.Forms.ContextMenuStrip contextMenu = new System.Windows.Forms.ContextMenuStrip();

            System.Windows.Forms.ToolStripMenuItem item = new System.Windows.Forms.ToolStripMenuItem("Export");
            item.Tag = 0;
            contextMenu.Items.Add(item);

            System.Windows.Forms.ToolStripMenuItem subItem = new System.Windows.Forms.ToolStripMenuItem("Export to file");
            subItem.Tag    = 0;
            subItem.Click += new EventHandler(itemExport_Click);
            item.DropDownItems.Add(subItem);

            bool exportToBasicPossible = true;

            foreach (ListViewItem listItem in listFiles.SelectedItems)
            {
                C64Studio.Types.FileInfo fileInfo = (C64Studio.Types.FileInfo)listItem.Tag;
                if (fileInfo.Type != C64Studio.Types.FileType.PRG)
                {
                    exportToBasicPossible = false;
                }
            }
            if (exportToBasicPossible)
            {
                subItem        = new System.Windows.Forms.ToolStripMenuItem("Export to Basic code");
                subItem.Tag    = 0;
                subItem.Click += new EventHandler(itemExportToBasic_Click);
                item.DropDownItems.Add(subItem);
            }

            // view in Hex display
            item        = new System.Windows.Forms.ToolStripMenuItem("View in Hex Editor");
            item.Tag    = 2;
            item.Click += new EventHandler(itemViewInHexEditor_Click);
            contextMenu.Items.Add(item);

            item        = new System.Windows.Forms.ToolStripMenuItem("Rename");
            item.Tag    = 2;
            item.Click += new EventHandler(itemRename_Click);
            contextMenu.Items.Add(item);

            item        = new System.Windows.Forms.ToolStripMenuItem("Delete");
            item.Tag    = 1;
            item.Click += new EventHandler(itemDelete_Click);
            contextMenu.Items.Add(item);

            contextMenu.Show(listFiles.PointToScreen(e.Location));
        }
Exemplo n.º 43
0
 public Sjediste(int i, List <DodajPutnikaKontrola.Putnik> putnici, FlowLayoutPanel flowLayoutPanel1, DodajPutnikaKontrola.Putnik putnik, string tmpMjesto, string tmpDatum, double p, System.Windows.Forms.ContextMenuStrip contextMenuStrip1)
 {
     InitializeComponent();
     this.label1.Text       = Convert.ToString(i);
     this.putnici           = putnici;
     this.flowLayoutPanel1  = flowLayoutPanel1;
     this.putnik            = putnik;
     this.tmpMjesto         = tmpMjesto;
     this.tmpDatum          = tmpDatum;
     this.cijena            = p;
     this.contextMenuStrip1 = contextMenuStrip1;
 }
Exemplo n.º 44
0
 private void SystemTray()
 {
     NotifyIcon = new System.Windows.Forms.NotifyIcon
     {
         Icon = System.Drawing.Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location)
     };
     contextMenu = new System.Windows.Forms.ContextMenuStrip();
     contextMenu.Items.Add("Open", null, new EventHandler((object sender, EventArgs args) => { OpenSite(); }));
     contextMenu.Items.Add("Restart", null, new EventHandler((object sender, EventArgs args) => RestartApplication()));
     contextMenu.Items.Add("Exit", null, new EventHandler((object sender, EventArgs args) => { Close(); }));
     NotifyIcon.ContextMenuStrip = contextMenu;
 }
Exemplo n.º 45
0
 public Karta(List <Putnik> putnici, FlowLayoutPanel flowLayoutPanel1, Putnik putnik, string tmpMjesto, string tmpDatum, int tmpBrojSjedista, double cijena, System.Windows.Forms.ContextMenuStrip contextMenuStrip1)
 {
     InitializeComponent();
     this.putnici           = putnici;
     this.flowLayoutPanel1  = flowLayoutPanel1;
     this.putnik            = putnik;
     this.tmpMjesto         = tmpMjesto;
     this.tmpDatum          = tmpDatum;
     this.tmpBrojSjedista   = tmpBrojSjedista;
     this.cijena            = cijena;
     this.contextMenuStrip1 = contextMenuStrip1;
 }
Exemplo n.º 46
0
        private void boxConsoleLog_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {   //click event
                var contextMenu = new System.Windows.Forms.ContextMenuStrip();
                var menuItem    = new ToolStripMenuItem("Copy");
                menuItem.Click += new EventHandler(CopyAction);
                contextMenu.Items.Add(menuItem);

                boxConsoleLog.ContextMenuStrip = contextMenu;
            }
        }
Exemplo n.º 47
0
        public System.Windows.Forms.ContextMenuStrip ShowContextMenu(System.Windows.Forms.Control parent, List <MySQL.Base.MenuItem> items,
                                                                     int x, int y, EventHandler handler)
        {
            System.Windows.Forms.ContextMenuStrip menu = new System.Windows.Forms.ContextMenuStrip();
            System.Windows.Forms.ToolStripItem[]  itemList;

            itemList = buildMenu(items, handler);
            menu.Items.AddRange(itemList);

            menu.Show(parent, new System.Drawing.Point(x, y), ToolStripDropDownDirection.BelowRight);
            return(menu);
        }
Exemplo n.º 48
0
        void PrizeMouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                ContextMenuStrip CMS = new System.Windows.Forms.ContextMenuStrip();
                CMS.Items.Add("Add formula");
                CMS.Items[0].Click += new EventHandler(AddFormula);

                CurrentPrizeBox = (sender as TextBox);
                (sender as TextBox).ContextMenuStrip = CMS;
                (sender as TextBox).ContextMenuStrip.Show(Cursor.Position);
            }
        }
Exemplo n.º 49
0
 private void pictureBox12_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
     }
     else
     {
         ContextMenuStrip my_menu = new System.Windows.Forms.ContextMenuStrip();
         my_menu.Items.Add("Ajouter").Name     = "Ajouter";
         my_menu.Items.Add("Deconnecter").Name = "Deconnecter";
         my_menu.Items.Add("Ajouter").Name     = "Ajouter";
     }
 }
Exemplo n.º 50
0
 private void zedGraph_ContextMenuBuilder(ZedGraphControl sender, System.Windows.Forms.ContextMenuStrip menuStrip, Point mousePt, ContextMenuObjectState objState)
 {
     // !!!
     // Переименуем (переведем на русский язык) некоторые пункты контекстного меню
     menuStrip.Items[0].Text = "Копировать";
     menuStrip.Items[1].Text = "Сохранить как картинку…";
     menuStrip.Items[2].Text = "Параметры страницы…";
     menuStrip.Items[3].Text = "Печать…";
     menuStrip.Items[4].Text = "Показывать значения в точках…";
     menuStrip.Items[5].Text = "Вернуть";
     menuStrip.Items[6].Text = "Вернуть начальное масштабирование";
     menuStrip.Items[7].Text = "Установить масштаб по умолчанию…";
 }
Exemplo n.º 51
0
 private void TreeNode_NodeMouseClick(object sender, System.Windows.Forms.TreeNodeMouseClickEventArgs e)
 {
     oTreeView.SelectedNode = e.Node;
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         System.Windows.Forms.ContextMenuStrip oContextMenu = this.GetContextMenu();
         if (oContextMenu != null)
         {
             System.Drawing.Point oPoint = new System.Drawing.Point(e.Node.Bounds.X + oTreeView.Left + 5, e.Node.Bounds.Y + oTreeView.Top + 15);
             oContextMenu.Show(this, oPoint);
         }
     }
 }
Exemplo n.º 52
0
        public void RegisterMenuItems(System.Windows.Forms.ContextMenuStrip contextMenu)
        {
            invokeMenuItem = new CustomMenuItem(this, "Invoke", new EventHandler(OnInvokeEvent));
            clearAllListenersForThisObject = new CustomMenuItem(this, "Remove Hawkeye's listeners for this object", new EventHandler(ClearListenersForThisObject));
            clearAllListeners = new CustomMenuItem(this, "Remove ALL Hawkeye's Listeners", new EventHandler(ClearListeners));

            contextMenu.Items.Insert(1, invokeMenuItem);
            contextMenu.Items.Add(clearAllListenersForThisObject);
            contextMenu.Items.Add(clearAllListeners);

            invokeMenuItem.Enabled = false;
            clearAllListenersForThisObject.Enabled = true;
            clearAllListeners.Enabled = true;
        }
Exemplo n.º 53
0
 public Sjediste(int i, List <DodajPutnikaKontrola.Putnik> putnici, FlowLayoutPanel flowLayoutPanel1, DodajPutnikaKontrola.Putnik putnik, string tmpMjesto, string tmpDatum, Image image, double p, System.Windows.Forms.ContextMenuStrip contextMenuStrip1)
 {
     InitializeComponent();
     this.label1.Text                 = Convert.ToString(i);
     this.putnici                     = putnici;
     this.flowLayoutPanel1            = flowLayoutPanel1;
     this.putnik                      = putnik;
     this.tmpMjesto                   = tmpMjesto;
     this.tmpDatum                    = tmpDatum;
     this.pictureBox1.BackgroundImage = image;
     this.cijena                      = p;
     this.contextMenuStrip1           = contextMenuStrip1;
     this.mozeSeKliknuti              = true;
 }
Exemplo n.º 54
0
 private void tb_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         ContextMenuStrip pop = new System.Windows.Forms.ContextMenuStrip();
         int position         = tb.HitTest(e.X, e.Y).RowIndex;
         if (position >= 0)
         {
             pop.Items.Add("Edito").Name = "Edito";
             pop.Items.Add("Fshij").Name = "Fshij";
         }
         pop.Show(tb, new Point(e.X, e.Y));
     }
 }
Exemplo n.º 55
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            TOCControl.SetBuddyControl(MainMap);
            TOCControl.EnableLayerDragDrop = true;

            ContextMenuStrip tocContextMenuStrip = new System.Windows.Forms.ContextMenuStrip();

            TOCControl.ContextMenuStrip = tocContextMenuStrip;

            TOCControl.ContextMenuStrip.Items.Add("缩放到图层", null, TOCContextMenuItem_ZoomToLayer);
            TOCControl.ContextMenuStrip.Items.Add("删除图层", null, TOCContextMenuItem_RemoveLayer);

            m_selectTool.OnCreate(MainMap.Object);
        }
Exemplo n.º 56
0
 public void ForceClose()
 {
     // Cuando se va a cerrar el formulario...
     // eliminar el objeto de la barra de tareas
     this.notifyIcon1.Visible = false;
     // esto es necesario, para que no se quede el icono en la barra de tareas
     // (el cual se quita al pasar el ratón por encima)
     this.notifyIcon1 = null;
     // de paso eliminamos el menú contextual
     _ContextMenu = null;
     this.Close();
     // finaliza todos los mensjaes de la aplicación
     Application.Exit();
 }
Exemplo n.º 57
0
        private void ZedgraphDemo_ContextMenuBuilder(ZedGraphControl sender, System.Windows.Forms.ContextMenuStrip menuStrip, Point mousePt, ContextMenuObjectState objState)
        {
            try
            {
                foreach (var key in keys)
                {
                    ToolStripMenuItem tsmi = new ToolStripMenuItem(key);
                    tsmi.Tag    = tsmi.Text;
                    tsmi.Click += new EventHandler(lt_CheckedChanged);
                    menuStrip.Items.Add(tsmi);
                }
                ToolStripMenuItem tsmiAll = new ToolStripMenuItem("All");
                tsmiAll.Tag    = tsmiAll.Text;
                tsmiAll.Click += new EventHandler(lt_CheckedChanged);
                menuStrip.Items.Add(tsmiAll);

                foreach (ToolStripMenuItem item in menuStrip.Items)
                {
                    if (( string )item.Tag == "copy") // “复制”菜单项
                    {
                        menuStrip.Items.Remove(item); //移除菜单项
                        item.Visible = false;         //不显示
                        break;
                    }
                }
                foreach (ToolStripMenuItem item in menuStrip.Items)
                {
                    if (( string )item.Tag == "page_setup") // “页面设置”菜单项
                    {
                        menuStrip.Items.Remove(item);       //移除菜单项
                        item.Visible = false;               //不显示
                        break;
                    }
                }
                foreach (ToolStripMenuItem item in menuStrip.Items)
                {
                    if (( string )item.Tag == "print") // “打印”菜单项
                    {
                        menuStrip.Items.Remove(item);  //移除菜单项
                        item.Visible = false;          //不显示
                        break;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 58
0
        public TrayIcon()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TrayIcon));
            this.TrayNotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);

            // Context menu strip
            this.TrayContextMenuStrip      = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.SettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

            this.TrayContextMenuStrip.SuspendLayout();
            this.SuspendLayout();

            //
            // Set up tray icon
            //
            this.TrayNotifyIcon.Icon    = ((System.Drawing.Icon)(resources.GetObject("taskbar.ico")));
            this.TrayNotifyIcon.Text    = "OpenHIPS";
            this.TrayNotifyIcon.Visible = true;
            // Attach menu strip
            this.TrayNotifyIcon.ContextMenuStrip  = this.TrayContextMenuStrip;
            this.TrayNotifyIcon.MouseClick       += new System.Windows.Forms.MouseEventHandler(this.TrayNotifyIcon_MouseClick);
            this.TrayNotifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.TrayNotifyIcon_MouseDoubleClick);

            //
            // TrayContextMenuStrip
            //
            this.TrayContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
                this.SettingsToolStripMenuItem,
            });
            this.TrayContextMenuStrip.Name = "TrayContextMenuStrip";
            this.TrayContextMenuStrip.Size = new System.Drawing.Size(115, 70);

            //
            // SettingsToolStripMenuItem
            //
            this.SettingsToolStripMenuItem.Name   = "SettingsToolStripMenuItem";
            this.SettingsToolStripMenuItem.Text   = "Settings...";
            this.SettingsToolStripMenuItem.Click += new System.EventHandler(this.SettingsToolStripMenuItem_Click);
            // TODO Set image for Settings

            InitializeComponent();

            // Make sure nothing shows except the tray icon initially
            this.TrayContextMenuStrip.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();
            this.HideSettingsForm();
        }
 private void dgvAddedProducts_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         ContextMenuStrip my_menu = new System.Windows.Forms.ContextMenuStrip();
         int position_mouse_click = dgvAddedProducts.HitTest(e.X, e.Y).RowIndex;
         if (position_mouse_click >= 0)
         {
             my_menu.Items.Add("Edit").Name   = "Edit";
             my_menu.Items.Add("Delete").Name = "Delete";
         }
         my_menu.Show(dgvAddedProducts, new Point(e.X, e.Y));
         my_menu.ItemClicked += new ToolStripItemClickedEventHandler(my_menu_ItemClicked);
     }
 }
Exemplo n.º 60
0
        void HandleContextMenuStripChanged(object sender, EventArgs e)
        {
            if (contextMenuStrip != null)
            {
                contextMenuStrip.Opened -= HandleContextMenuStripOpened;
                contextMenuStrip.Closed -= HandleContextMenuStripClosed;
            }
            contextMenuStrip = Control.ContextMenuStrip;

            if (contextMenuStrip != null)
            {
                contextMenuStrip.Opened += HandleContextMenuStripOpened;
                contextMenuStrip.Closed += HandleContextMenuStripClosed;
            }
        }