Esempio n. 1
0
        private void RightClickMenuItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            ToolStripItem item = e.ClickedItem;

            switch (item.ToString())
            {
            case "Save Image":
                cmRightClickMenu.Hide();
                SaveFileDialog savefile = new SaveFileDialog();
                savefile.FileName = "ScottPlot.png";
                savefile.Filter   = "PNG Files (*.png)|*.png|All files (*.*)|*.*";
                if (savefile.ShowDialog() == DialogResult.OK)
                {
                    plt.SaveFig(savefile.FileName);
                }
                break;

            case "Auto-Axis":
                cmRightClickMenu.Hide();
                plt.AxisAuto();
                Render();
                break;

            case "Clear":
                cmRightClickMenu.Hide();
                plt.Clear();
                Render();
                break;

            case "About ScottPlot":
                cmRightClickMenu.Hide();
                System.Diagnostics.Process.Start("https://github.com/swharden/ScottPlot");
                break;
            }
        }
Esempio n. 2
0
        public static void RightClickMenuItemClicked(ToolStripItem item, ContextMenuStrip rightClickMenu, ScottPlot.Plot plt)
        {
            Console.WriteLine("CLICKED:" + item.ToString());
            SaveFileDialog savefile = new SaveFileDialog();
            string         itemName = item.ToString();

            if (itemName.StartsWith("About"))
            {
                itemName = "About";
            }

            switch (itemName)
            {
            case "Save Image":
                rightClickMenu.Hide();
                savefile.FileName = "ScottPlot.png";
                savefile.Filter   = "PNG Files (*.png)|*.png|All files (*.*)|*.*";
                if (savefile.ShowDialog() == DialogResult.OK)
                {
                    plt.SaveFig(savefile.FileName);
                }
                break;

            case "Save Data":
                savefile.Title    = "Save data for the first plot object";
                savefile.FileName = "data.csv";
                savefile.Filter   = "CSV Files (*.csv)|*.csv|All files (*.*)|*.*";
                if (savefile.ShowDialog() == DialogResult.OK)
                {
                    plt.GetPlottables()[0].SaveCSV(savefile.FileName);
                }
                break;

            case "Auto-Axis":
                rightClickMenu.Hide();
                plt.AxisAuto();
                break;

            case "Clear":
                rightClickMenu.Hide();
                plt.Clear();
                break;

            case "Toggle quality while dragging":
                plt.mouseTracker.lowQualityWhileDragging = !plt.mouseTracker.lowQualityWhileDragging;
                break;

            case "ScottPlot":
                rightClickMenu.Hide();
                System.Diagnostics.Process.Start("https://github.com/swharden/ScottPlot");
                break;
            }
        }
Esempio n. 3
0
 private void buttonFile_Click(object sender, EventArgs e)
 {
     if (flag_for_button)
     {
         contextMenuStrip1.Show(buttonFile, new Point(buttonFile.Location.X, buttonFile.Height));
         flag_for_button = false;
     }
     else
     {
         contextMenuStrip1.Hide();
         flag_for_button = true;
     }
 }
Esempio n. 4
0
 //handler for click on field
 private void FieldButton_Click(object sender, EventArgs e)
 {
     if (((MouseEventArgs)e).Button == MouseButtons.Left)
     {
         infoMenu.Hide();
         infoMenu.Items.Clear();
         //MessageBox.Show("Left Clicked at " + ((FieldButton)sender).Name);
     }
     else if (((MouseEventArgs)e).Button == MouseButtons.Right)
     {
         //MessageBox.Show("Right Clicked at " + ((FieldButton)sender).Name);
     }
 }
Esempio n. 5
0
        private void RightClickMenuItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            rightClickMenu.Hide();
            switch (e.ClickedItem.Text)
            {
            case "Save Image":
                SaveFileDialog savefile = new SaveFileDialog();
                savefile.FileName = "ScottPlot.png";
                savefile.Filter   = "PNG Files (*.png)|*.png;*.png";
                savefile.Filter  += "|JPG Files (*.jpg, *.jpeg)|*.jpg;*.jpeg";
                savefile.Filter  += "|BMP Files (*.bmp)|*.bmp;*.bmp";
                savefile.Filter  += "|TIF files (*.tif, *.tiff)|*.tif;*.tiff";
                savefile.Filter  += "|All files (*.*)|*.*";
                if (savefile.ShowDialog() == DialogResult.OK)
                {
                    plt.SaveFig(savefile.FileName);
                }
                break;

            case "Settings":
                var formSettings = new UserControls.FormSettings(plt);
                formSettings.ShowDialog();
                Render();
                break;

            case "Help":
                var formHelp = new UserControls.FormHelp();
                formHelp.ShowDialog();
                break;

            default:
                throw new NotImplementedException();
            }
        }
Esempio n. 6
0
        private void MenuMap_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (e.ClickedItem.Name == "openshapefile")
            {
                OpenFileDialog dialog = new OpenFileDialog();
                dialog.Title       = "Open Shape File";
                dialog.Filter      = "SHP files|*.shp";
                dialog.Multiselect = true;
                try
                {
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        foreach (var item in dialog.FileNames)
                        {
                            FileInfo fi = new FileInfo(item);
                            Myfile.Add(fi.Name, item);
                            CreateNewLayer(fi.Name);
                        }
                        //pathToFile = dialog.FileName;
                        //FileInfo fi = new FileInfo(pathToFile);
                        //Myfile.Add(fi.Name, pathToFile);
                        //CreateNewLayer(fi.Name);
                    }
                    checkedListBox1.Visible   = true;
                    bunifuFlatButton5.Visible = true;
                    bunifuFlatButton4.Visible = true;
                    bunifuFlatButton6.Visible = true;
                }
                catch
                {
                    MessageBox.Show("Layer đã tồn tại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            if (e.ClickedItem.Name == "saveas")
            {
                menuMap.Hide();
                SaveFileDialog sf = new SaveFileDialog();
                // Feed the dummy name to the save dialog

                try
                {
                    sf.Filter = "SHP files|*.shp";
                    if (sf.ShowDialog() == DialogResult.OK)
                    {
                        // Now here's our save folder
                        Shapefile shapefile = MainMap.get_Shapefile(m_layerHandle);

                        //string savePath = Path.GetDirectoryName(sf.FileName);
                        // Do whatever
                        shapefile.SaveAs(sf.FileName, null);
                        MessageBox.Show("Create new shapefile successfully" + Environment.NewLine + "File name:" + sf.FileName, "System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch
                {
                    MessageBox.Show("Error 404 Not Found!");
                }
            }
        }
Esempio n. 7
0
        private void BindMenuStrip(DataGridView grid)
        {
            var menu = new ContextMenuStrip();

            menu.Items.Add("复制");
            menu.Items.Add("查看当前数据源");

            menu.ItemClicked += (s, e) =>
            {
                ContextMenuStrip toolstrip = e.ClickedItem.GetCurrentParent() as ContextMenuStrip;

                ComponentDataGrid getDgv = toolstrip.SourceControl as ComponentDataGrid;
                toolstrip.Hide();

                if (e.ClickedItem.Text.Equals("查看当前数据源"))
                {
                    new frmDataSource(grid.Name, (getDgv.DataSource as DataTable).Namespace).ShowDialog();
                }
                else if (e.ClickedItem.Text.Equals("复制"))
                {
                    Clipboard.SetText(getDgv.CurrentCell.Value.ToString(), TextDataFormat.UnicodeText);
                }
            };

            grid.ContextMenuStrip = menu;
        }
Esempio n. 8
0
        private void contextMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            cm.Hide();
            ToolStripItem item = e.ClickedItem;

            if (item.Text.Equals("Minimize"))
            {
                this.WindowState = FormWindowState.Minimized;
            }
            else if (item.Text.Equals("Close"))
            {
                this.Close();
            }
            else if (item.Text.Equals("Toggle"))
            {
                double val = this.Opacity;
                //Đang trong suốt
                if (val < 1)
                {
                    this.Opacity = 1;
                }
                else
                {
                    this.Opacity = TRONG_SUOT;
                }
            }
        }
        void s_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            switch (e.ClickedItem.Name.ToString())
            {
            case "Eliminar":
                s.Hide();
                MessageBox.Show(bajas(dataGridView1.CurrentCell.Value.ToString()));
                break;

            case "Modificar":
                s.Hide();
                // Agregar a = new Agregar();
                modi();
                this.Hide();
                break;
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Process menu items
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cms_clicked(object sender, ToolStripItemClickedEventArgs e)
        {
            // Use sender to hide menu
            ContextMenuStrip menu = (ContextMenuStrip)(sender);

            // Open in explorer or save file
            if (e.ClickedItem.Name == "open")
            {
                menu.Hide();
                explore_file(item_path);
            }
            else if (e.ClickedItem.Name == "save")
            {
                menu.Hide();
                save_one_photo(item_path);
            }
        }
Esempio n. 11
0
 public virtual void HideDropDown()
 {
     if (m_droppedDown)
     {
         m_contextMenu.Hide();
         m_droppedDown = false;
     }
 }
Esempio n. 12
0
 private void context_VisibleChanged(object sender, EventArgs e)
 {
     if (!clck)
     {
         ContextMenuStrip.Hide();
         OnClick(new EventArgs());
     }
 }
Esempio n. 13
0
 private void hideDropDown()
 {
     menu.Hide();
     if (DropDownClosed != null)
     {
         DropDownClosed(this, EventArgs.Empty);
     }
 }
Esempio n. 14
0
 void right_click(Object sender, ToolStripItemClickedEventArgs e, int index, ContextMenuStrip my_menu)
 {
     if (e.ClickedItem.Name.ToString() == "Delete")
     {
         my_menu.Hide();
         if (MessageBox.Show("Do you want to delete employee?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
         {
             deleteEmployee(index);
             MessageBox.Show("Employee Deleted");
         }
     }
     else if (e.ClickedItem.Name.ToString() == "View")
     {
         my_menu.Hide();
         EmployeeForm f = new EmployeeForm(this);
         f.View(index);
         f.ShowDialog();
     }
 }
Esempio n. 15
0
 void right_click(Object sender, ToolStripItemClickedEventArgs e, int index, ContextMenuStrip my_menu)
 {
     if (e.ClickedItem.Name.ToString() == "Received")
     {
         my_menu.Hide();
         if (MessageBox.Show("Are you sure Order is received?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
         {
             UpdateOrder(index);
             MessageBox.Show("Order Received");
         }
     }
 }
        private void OnNotifyIconClick(object?sender, EventArgs e)
        {
            if (_isContextMenuVisible)
            {
                _contextMenuStrip.Hide();
            }
            else
            {
                _contextMenuStrip.Show();
            }

            _isContextMenuVisible = !_isContextMenuVisible;
        }
Esempio n. 17
0
 protected override void OnClick(EventArgs e)
 {
     base.OnClick(e);
     if (((MouseEventArgs)e).Button == MouseButtons.Left && ContextMenuStrip != null)
     {
         if (!ContextMenuStrip.Visible)
         {
             ContextMenuStrip.Show(this, this.Width, 0);
         }
         else
         {
             ContextMenuStrip.Hide();
         }
     }
 }
Esempio n. 18
0
        int OnMouseLLHook(int code, WM message, IntPtr state)
        {
            try
            {
                if (message == WM.LBUTTONDOWN)
                {
                    var clientPos = virtualContextMenu.PointToClient(Cursor.Position);
                    if (virtualContextMenu.Visible && virtualContextMenu.ClientRectangle.Contains(clientPos) == false)
                    {
                        virtualContextMenu.Hide();
                    }
                }
                if (message == WM.RBUTTONUP)
                {
                    // コンテキストメニューを表示
                    virtualContextMenu.Items.Clear();

                    for (int i = 0; i < appGraph.edges.Count; i++)
                    {
                        AppEdge appEdge = appGraph.edges[i];
                        if (!IsValidEdge(appEdge, TriggerType.ContextMenu))
                        {
                            continue;
                        }
                        var item = new ToolStripMenuItem(appEdge.ActionHandler.ContextMenuText);
                        item.Click += (s, ee) => ExecuteActionHandler(appEdge);
                        item.Invalidate();
                        virtualContextMenu.Items.Add(item);
                    }

                    if (virtualContextMenu.Items.Count >= 1)
                    {
                        ToolStripMenuItem[] itemList = new ToolStripMenuItem[virtualContextMenu.Items.Count];
                        for (int j = 0; j < virtualContextMenu.Items.Count; j++)
                        {
                            itemList[j] = virtualContextMenu.Items[j] as ToolStripMenuItem;
                        }
                        virtualContextMenu.Show(new Point(Cursor.Position.X, Cursor.Position.Y - 22 * virtualContextMenu.Items.Count));
                    }
                }
                return(CallNextHookEx(mouseHook, code, message, state));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(CallNextHookEx(mouseHook, code, message, state));
            }
        }
Esempio n. 19
0
 void formatBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab)
     {
         ToolStripTextBox box = sender as ToolStripTextBox;
         if (box != null && box.Text.Trim() != "" && UnitValue != null)
         {
             try
             {
                 Text = UnitValue.ToString(box.Text);
             }
             catch { }
         }
         m_menu.Hide();
     }
 }
Esempio n. 20
0
    private void presentRightClickMenu(ContextMenuStrip menu)
    {
        //clear all items currently in the menu
        menu.Items.Clear();

        //is anything selected?
        if (p_Tree.SelectedNode == null)
        {
            return;
        }

        //position the menu where the mouse is
        menu.SetBounds(Cursor.Position.X, Cursor.Position.Y, menu.Width, menu.Height);
        menu.Hide(); menu.Show();

        //get the selected tag
        object tag = p_Tree.SelectedNode.Tag;

        /*Solution entry*/
        if (tag is Solution)
        {
            return;
        }


        /*ProjectEntity/Project items*/
        if (tag is Project || tag is ProjectDirectory)
        {
            ToolStripMenuItem add = (ToolStripMenuItem)menu.Items.Add("Add", null);

            add.DropDownItems.Add(getRightClickItem_Add_NewItem());
            add.DropDownItems.Add(getRightClickItem_Add_ExistingItem());
            add.DropDownItems.Add(getRightClickItem_Add_NewFolder());

            menu.Items.Add(new ToolStripSeparator());
        }

        #region Clipboard
        ToolStripItem cut   = menu.Items.Add("Cut", Icons.GetBitmap("menu.cut", 16), null);
        ToolStripItem copy  = menu.Items.Add("Copy", Icons.GetBitmap("menu.copy", 16), null);
        ToolStripItem paste = menu.Items.Add("Paste", Icons.GetBitmap("menu.paste", 16), null);
        menu.Items.Add(getRightClickItem_Delete());
        menu.Items.Add(new ToolStripSeparator());
        #endregion
    }
Esempio n. 21
0
 private void listBoxControl1_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         ListBoxControl               edit = sender as ListBoxControl;
         BaseListBoxViewInfo          vi   = edit.GetViewInfo() as BaseListBoxViewInfo;
         BaseListBoxViewInfo.ItemInfo ii   = vi.GetItemInfoByPoint(e.Location) as BaseListBoxViewInfo.ItemInfo;
         if (ii != null)
         {
             edit.SelectedIndex = ii.Index;
             listMenu.Show(Cursor.Position);
         }
         else
         {
             listMenu.Hide();
         }
     }
 }
Esempio n. 22
0
        /// <summary>
        /// Executes context menu commands
        /// </summary>
        void m_contextMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            m_contextMenu.Hide();
            Application.DoEvents();
            switch (e.ClickedItem.Text)
            {
            case CONTEXT_ADD_TO_FAVORITE:
                AddProjectionToFavorite(m_selectedNode.Tag as CoordinateSystem);
                break;

            case CONTEXT_SHOW_PROPERTIES:
                ShowProjectionProperties(m_selectedNode.Tag as CoordinateSystem);
                break;

            case CONTEXT_REMOVE_FROM_FAVORITE:
                RemoveFromFavorite(m_selectedNode.Tag as CoordinateSystem);
                break;
            }
        }
Esempio n. 23
0
        private void OnEntryButtonClick(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            if (sshMenuStrip.Visible)
            {
                sshMenuStrip.Visible = false;
                sshMenuStrip.Hide();
            }
            else
            {
                var button = sender as Button;
                sshMenuStrip.Visible = true;
                sshMenuStrip.Show(button, new Point(0, button.Height));
            }
        }
Esempio n. 24
0
        private void BuildContextMenu()
        {
            TrayIconContextMenu.Hide();
            TrayIconContextMenu.Items.Clear();

            TrayIconContextMenu.Items.Add(DashboardMenuItem);

            if (_service.IsInstalled)
            {
                TrayIconContextMenu.Items.Add(ServiceMenuItem);
            }

            TrayIconContextMenu.Items.AddRange(new ToolStripItem[]
            {
                DividerMenuItem,
                AboutMenuItem,
                DividerMenuItem,
                ExitMenuItem
            });
        }
Esempio n. 25
0
        private void OpenContextMenu(Control control, ContextMenuStrip menu)
        {
            CloseRemainingMenus(menu);

            if (menu.Visible)
            {
                menu.Hide();
            }
            else
            {
                if (menu == contextMenuDevice)
                {
                    UpdateConnectionState();
                }

                control.ContextMenuStrip = menu;
                Point p = new Point(0, 25);
                control.ContextMenuStrip.Show(control, p);
            }
        }
Esempio n. 26
0
        private void btnWizard_Click(object sender, EventArgs e)
        {
            if (ctxMenuWizard.Items.Count < 1)
            {
                return;
            }
            var p = new Point(btnWizard.Width, 0);

            // fix self collapse on first appearance
            if (!ctxMenuWizard.Created)
            {
                // we needs to show/hide it
                // temporary set zero height to avoid flicks
                var height = ctxMenuWizard.Height;
                ctxMenuWizard.Height = 0;
                ctxMenuWizard.Show(btnWizard, p);
                ctxMenuWizard.Hide();
                ctxMenuWizard.Height = height;
            }
            ctxMenuWizard.Show(btnWizard, p);
        }
Esempio n. 27
0
        /// <summary>
        /// Handling mouse down event of the cotnrol.
        /// </summary>
        /// <param name="e">MouseEventArgs</param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (e.Location.Y > 0 && e.Location.Y < Height)
            {
                if (e.Location.X > 0 && e.Location.X < ButtonWidth)
                {
                    Pressed = true;
                }
                else
                {
                    Pressed = false;
                }

                if (e.Location.X > ButtonWidth && e.Location.X < Width)
                {
                    SplitPressed = true;
                }
                else
                {
                    SplitPressed = false;
                }
            }

            //Pressed = true;
            //SplitPressed = true;

            if (SplitPressed)
            {
                menu?.Show(this, 0, this.Height - 1);
            }
            else
            {
                menu?.Hide();
                base.OnMouseDown(e);
            }

            Focus();
            Invalidate();
        }
Esempio n. 28
0
 private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
 {
     if (e.ClickedItem == toolStripEnabled)
     {
         ListenerEnabled = !ListenerEnabled;
     }
     else if (e.ClickedItem == toolStripClear)
     {
         this.Clear();
     }
     else if (e.ClickedItem == toolStripSaveToFile)
     {
         contextMenuStrip1.Hide(); //Hide context menu.
         using (SaveFileDialog dlg = new SaveFileDialog())
         {
             if (dlg.ShowDialog() == DialogResult.OK)
             {
                 System.IO.File.WriteAllText(dlg.FileName, this.Text);
             }
         }
     }
 }
Esempio n. 29
0
        private void RightClickMenuItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            rightClickMenu.Hide();
            switch (e.ClickedItem.Text)
            {
            case "Save Image":
                Tools.SaveImageDialog(plt);
                break;

            case "Settings":
                var formSettings = new UserControls.FormSettings(plt);
                formSettings.ShowDialog();
                break;

            case "Help":
                var formHelp = new UserControls.FormHelp();
                formHelp.ShowDialog();
                break;

            default:
                throw new NotImplementedException();
            }
        }
Esempio n. 30
0
        protected virtual void ctCopy_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            RightMenu.Hide();
            if (e.ClickedItem.Text == "复制")
            {
                if (this.CurrentCell != null)
                {
                    Clipboard.SetDataObject(TryParse.ToString(this.CurrentCell.Value).Trim());
                }
            }
            else if (e.ClickedItem.Text == "粘贴")
            {
                if (this.CurrentCell != null && !this.CurrentCell.ReadOnly && !this.ReadOnly)
                {
                    IDataObject iData = Clipboard.GetDataObject();

                    if (iData.GetDataPresent(DataFormats.Text))
                    {
                        this.CurrentCell.Value = iData.GetData(DataFormats.Text);
                    }
                }
            }
        }
Esempio n. 31
0
    private void presentRightClickMenu(ContextMenuStrip menu)
    {
        //clear all items currently in the menu
        menu.Items.Clear();

        //is anything selected?
        if (p_Tree.SelectedNode == null) { return; }

        //position the menu where the mouse is
        menu.SetBounds(Cursor.Position.X, Cursor.Position.Y, menu.Width, menu.Height);
        menu.Hide(); menu.Show();

        //get the selected tag
        object tag = p_Tree.SelectedNode.Tag;

        /*Solution entry*/
        if (tag is Solution) {
            return;
        }

        /*ProjectEntity/Project items*/
        if (tag is Project || tag is ProjectDirectory) {
            ToolStripMenuItem add = (ToolStripMenuItem)menu.Items.Add("Add", null);

            add.DropDownItems.Add(getRightClickItem_Add_NewItem());
            add.DropDownItems.Add(getRightClickItem_Add_ExistingItem());
            add.DropDownItems.Add(getRightClickItem_Add_NewFolder());

            menu.Items.Add(new ToolStripSeparator());
        }

        #region Clipboard
        ToolStripItem cut = menu.Items.Add("Cut", Icons.GetBitmap("menu.cut", 16), null);
        ToolStripItem copy = menu.Items.Add("Copy", Icons.GetBitmap("menu.copy", 16), null);
        ToolStripItem paste = menu.Items.Add("Paste", Icons.GetBitmap("menu.paste", 16), null);
        menu.Items.Add(getRightClickItem_Delete());
        menu.Items.Add(new ToolStripSeparator());
        #endregion
    }