Beispiel #1
0
        private void UpdateRightClick()
        {
            // 우선 테스트 정도로 작동 대충 되도록 짜봤음
            if (_drawState == DrawState.NONE)
            {
                if (Scene.CurrentScene.IsRightMouseUp)
                {
                    //UnselectAll();
                    //Select(_nearShapes[0]);
                    _rightPos        = _pos;
                    _rightNearShapes = _nearShapes.ToList();
                    _menuStrip.Show(System.Windows.Forms.Control.FromHandle(Scene.CurrentScene.Window.Handle),
                                    Scene.CurrentScene.MousePosition.X, Scene.CurrentScene.MousePosition.Y);
                }
            }

            /*
             * if (_shapeMenuStrip.IsSelected)
             * {
             *  if (_shapeMenuStrip.SelectedItem.Text == "Delete")
             *      DeleteSelected();
             *  else if (_shapeMenuStrip.SelectedItem.Text == "Merge")
             *      UpdateAttach();
             * }
             */
        }
Beispiel #2
0
 internal void showContextMenu(int x, int y)
 {
     if (CITS_IE_Addon.Main.Recorder.isRunning())
     {
         contextMenu.Show(x, y);
     }
 }
        private void dgv_ET_Peak_List_CellClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            int clickedRow = dgv_ET_Peak_List.HitTest(e.X, e.Y).RowIndex;
            int clickedCol = dgv_ET_Peak_List.HitTest(e.X, e.Y).ColumnIndex;

            if (clickedRow < Sweet.lollipop.et_relations.Count && clickedRow >= 0 && clickedCol >= 0 && clickedCol < dgv_ET_Peak_List.ColumnCount)
            {
                if (e.Button == System.Windows.Forms.MouseButtons.Left)
                {
                    ct_ET_peakList.ChartAreas[0].AxisX.StripLines.Clear();
                    DeltaMassPeak selected_peak = (dgv_ET_Peak_List.Rows[clickedRow].DataBoundItem as DisplayObject).display_object as DeltaMassPeak;
                    DisplayUtility.GraphSelectedDeltaMassPeak(ct_ET_peakList, selected_peak, Sweet.lollipop.et_relations);
                }
                else
                {
                    if (e.Button == System.Windows.Forms.MouseButtons.Right && clickedRow >= 0 && clickedRow < Sweet.lollipop.et_relations.Count)
                    {
                        System.Windows.Forms.ContextMenuStrip ET_peak_List_Menu = new System.Windows.Forms.ContextMenuStrip();
                        int position_xy_mouse_row = dgv_ET_Peak_List.HitTest(e.X, e.Y).RowIndex;

                        DisplayDeltaMassPeak selected_peak = dgv_ET_Peak_List.Rows[clickedRow].DataBoundItem as DisplayDeltaMassPeak;

                        if (position_xy_mouse_row > 0)
                        {
                            ET_peak_List_Menu.Items.Add("Increase Experimental Mass " + Lollipop.MONOISOTOPIC_UNIT_MASS + " Da").Name = "IncreaseMass";
                            ET_peak_List_Menu.Items.Add("Decrease Experimental Mass " + Lollipop.MONOISOTOPIC_UNIT_MASS + " Da").Name = "DecreaseMass";
                        }
                        ET_peak_List_Menu.Show(dgv_ET_Peak_List, new System.Drawing.Point(e.X, e.Y));

                        //event menu click
                        ET_peak_List_Menu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler((s, ev) => ET_peak_List_Menu_ItemClicked(s, ev, selected_peak));
                    }
                }
            }
        }
Beispiel #4
0
        private void CreateContextualMenu(TimelineNode node)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            System.Windows.Forms.ContextMenuStrip contextMenuStrip = new System.Windows.Forms.ContextMenuStrip();

            bool isVisualStudio = EditorContext.IsEnvironment(EditorContext.ExecutionEnvironment.VisualStudio);

            if (node.Value is CompileValue)
            {
                var value = node.Value as CompileValue;

                if (isVisualStudio && node.Category == CompilerData.CompileCategory.Include)
                {
                    contextMenuStrip.Items.Add(Common.UIHelpers.CreateContextItem("Open Location (Experimental)", (sender, e) => EditorUtils.OpenFile(value.Name)));
                }

                if (value.Name.Length > 0)
                {
                    contextMenuStrip.Items.Add(Common.UIHelpers.CreateContextItem("Copy Name", (sender, e) => Clipboard.SetText(value.Name)));
                }
            }
            else if (node.Value is UnitValue)
            {
                var value = node.Value as UnitValue;

                if (value.Name.Length > 0)
                {
                    contextMenuStrip.Items.Add(Common.UIHelpers.CreateContextItem("Copy Name", (sender, e) => Clipboard.SetText(value.Name)));
                }
            }

            contextMenuStrip.Show(System.Windows.Forms.Control.MousePosition);
        }
        private void DataGridRow_ContextMenu(object sender, MouseEventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var           dataGrid      = (DataGrid)sender;
            HitTestResult hitTestResult = VisualTreeHelper.HitTest(dataGrid, Mouse.GetPosition(dataGrid));
            DataGridRow   row           = hitTestResult.VisualHit.GetParentOfType <DataGridRow>();

            dataGrid.SelectedItem = row.Item;

            UnitValue value = (row.Item as UnitValue);

            if (value == null)
            {
                return;
            }

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

            bool isVisualStudio = EditorContext.IsEnvironment(EditorContext.ExecutionEnvironment.VisualStudio);

            contextMenuStrip.Items.Add(Common.UIHelpers.CreateContextItem("Open Timeline", (a, b) => Timeline.CompilerTimeline.Instance.DisplayTimeline(value)));

            contextMenuStrip.Items.Add(Common.UIHelpers.CreateContextItem("Open Location (Experimental)", (a, b) => EditorUtils.OpenFile(value.Name)));

            if (value.Name.Length > 0)
            {
                contextMenuStrip.Items.Add(Common.UIHelpers.CreateContextItem("Copy Name", (a, b) => Clipboard.SetText(value.Name)));
            }

            contextMenuStrip.Show(System.Windows.Forms.Control.MousePosition);
        }
Beispiel #6
0
        private void ShowAddresList(DataTable tbl)
        {
            List <string> addrlist = new List <string>();

            foreach (DataRow row in tbl.Rows)
            {
                addrlist.Add((string)row["住所漢字"]);
            }
            if (addrlist == null || addrlist.Count == 0)
            {
                return;
            }
            if (addrlist.Count == 1)
            {
                住所1 = addrlist[0];
                return;
            }

            cMenu = new System.Windows.Forms.ContextMenuStrip();
            cMenu.PreviewKeyDown += cMenu_PreviewKeyDown;
            foreach (string addr in addrlist)
            {
                cMenu.Items.Add(addr, null, new System.EventHandler(SelectedAddress));
            }
            Point pnt = this.ZipCode.PointToScreen(new Point(0.0, 0.0));

            cMenu.Show((int)pnt.X + 80, (int)(pnt.Y) + 28);
        }
Beispiel #7
0
 public static void ShowContextMenu(object owner, string addInTreePath, System.Windows.Forms.Control parent, int x, int y)
 {
     System.Windows.Forms.ContextMenuStrip contextMenuStrip = MenuService.CreateContextMenu(owner, addInTreePath);
     if (contextMenuStrip != null)
     {
         contextMenuStrip.Show(parent, new System.Drawing.Point(x, y));
     }
 }
Beispiel #8
0
 private void CreateChildSelectionMenu(LayoutNode node)
 {
     System.Windows.Forms.ContextMenuStrip contextMenuStrip = new System.Windows.Forms.ContextMenuStrip();
     for (int i = 0; i < node.Children.Count; ++i)
     {
         int        index   = i; //Copy to local variable in order to work for the click callback
         LayoutNode child   = node.Children[index];
         var        element = new System.Windows.Forms.ToolStripMenuItem();
         element.Text   = String.IsNullOrEmpty(child.Name)? (String.IsNullOrEmpty(child.Type)? child.Category.ToString() : child.Type) : child.Name;
         element.Click += (sender, e) => TriggerNodeExpansion(node, index);
         contextMenuStrip.Items.Add(element);
     }
     contextMenuStrip.Show(System.Windows.Forms.Control.MousePosition);
 }
Beispiel #9
0
        private void InitializeNotifyIcon()
        {
            _notifyIcon = new System.Windows.Forms.NotifyIcon
            {
                Text    = App.reCLIName,
                Icon    = reCLI.Properties.Resources.app,
                Visible = true
            };

            var menu  = new System.Windows.Forms.ContextMenuStrip();
            var items = menu.Items;

            _notifyIcon.DoubleClick += (o, e) => MainViewModel.Current.MainWindowVisibility = Visibility.Visible;

            var open = items.Add("打开");

            open.Click += (o, e) => MainViewModel.Current.MainWindowVisibility = Visibility.Visible;
            var exit = items.Add("退出");

            exit.Click += (o, e) => MainWindow.Close();

            _notifyIcon.ContextMenuStrip = menu;
            _notifyIcon.MouseClick      += (o, e) =>
            {
                if (e.Button == System.Windows.Forms.MouseButtons.Left)
                {
                    if (menu.Visible)
                    {
                        menu.Close();
                    }
                    else
                    {
                        var p = System.Windows.Forms.Cursor.Position;
                        menu.Show(p);
                    }
                }
            };
        }
Beispiel #10
0
 private void notifyIcon1_BalloonTipClicked(object sender, EventArgs e)
 {
     contextMenuStrip1.Show(System.Windows.Forms.Control.MousePosition);
 }
Beispiel #11
0
        private void CreateContextualMenu(LayoutNode node)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            System.Windows.Forms.ContextMenuStrip contextMenuStrip = new System.Windows.Forms.ContextMenuStrip();

            bool hasFieldLocation = node.FieldLocation != null;
            bool hasTypeLocation  = node.TypeLocation != null;
            bool hasParent        = node.Parent != null;
            bool hasChildren      = node.Children.Count > 0;

            bool hasName = node.Name.Length > 0;
            bool hasType = node.Type.Length > 0;

            //Open Location
            if (hasFieldLocation)
            {
                contextMenuStrip.Items.Add(CreateContextMenu("Open Field Location", (sender, e) => OpenLocation(node.FieldLocation)));
            }

            if (hasTypeLocation)
            {
                contextMenuStrip.Items.Add(CreateContextMenu("Open Type Location", (sender, e) => OpenLocation(node.TypeLocation)));
            }

            //Separator
            if (contextMenuStrip.Items.Count > 0 && (hasParent || hasChildren))
            {
                contextMenuStrip.Items.Add(new System.Windows.Forms.ToolStripSeparator());
            }

            //Expand/Collapse
            if (hasParent)
            {
                contextMenuStrip.Items.Add(CreateContextMenu("Collapse Parent", (sender, e) => ToggleCollapse(node.Parent)));
            }

            if (hasChildren)
            {
                contextMenuStrip.Items.Add(CreateContextMenu(node.IsExpanded ? "Collapse" : "Expand", (sender, e) => ToggleCollapse(node)));
            }

            //Separator
            if (contextMenuStrip.Items.Count > 0 && (hasFieldLocation || hasTypeLocation || hasName || hasType))
            {
                contextMenuStrip.Items.Add(new System.Windows.Forms.ToolStripSeparator());
            }

            //Clipboard
            if (hasName)
            {
                contextMenuStrip.Items.Add(CreateContextMenu("Copy Field Name", (sender, e) => Clipboard.SetText(node.Name)));
            }

            if (hasFieldLocation)
            {
                contextMenuStrip.Items.Add(CreateContextMenu("Copy Field Filename", (sender, e) => Clipboard.SetText(node.FieldLocation.Filename)));
            }

            if (hasType)
            {
                contextMenuStrip.Items.Add(CreateContextMenu("Copy Type Name", (sender, e) => Clipboard.SetText(node.Type)));
            }

            if (hasTypeLocation)
            {
                contextMenuStrip.Items.Add(CreateContextMenu("Copy Type Filename", (sender, e) => Clipboard.SetText(node.TypeLocation.Filename)));
            }

            contextMenuStrip.Show(System.Windows.Forms.Control.MousePosition);
        }
Beispiel #12
0
 public override void Show()
 {
     strip.Show(System.Windows.Forms.Cursor.Position);
 }