예제 #1
0
        public void ChildClick(object sender, System.EventArgs e)
        {
            //MessageBox.Show(string.Concat("You have Clicked '", sender.ToString(), "' Menu"), "Menu Items Event", MessageBoxButtons.OK, MessageBoxIcon.Information);
            try
            {
                bool found = false;

                CustomToolStripMenuItem menuItem = (CustomToolStripMenuItem)sender;

                //if is already open, activate it
                foreach (Form form in Application.OpenForms)
                {
                    if (form.Name == menuItem.FormName)
                    {
                        found = true;
                        form.Activate();
                        //form.Dock = DockStyle.Fill;
                        //form.WindowState = FormWindowState.Maximized;
                    }
                    //else
                    //{
                    //    if (form.Name != "Main")
                    //        form.WindowState = FormWindowState.Normal;
                    //}
                }

                //if not, open it
                if (found == false)
                {
                    Assembly frmAssembly = Assembly.LoadFile(Application.ExecutablePath);
                    foreach (Type type in frmAssembly.GetTypes())
                    {
                        if (type.BaseType == typeof(Form) || type.BaseType == typeof(RibbonFormBase))
                        {
                            if (type.Name == menuItem.FormName)
                            {
                                found = true;

                                Form frmShow = (Form)frmAssembly.CreateInstance(type.ToString());
                                frmShow.MdiParent = this;
                                frmShow.ShowIcon  = false;
                                //frmShow.Dock = DockStyle.Fill;
                                //frmShow.ControlBox = false;
                                frmShow.Show();
                                frmShow.WindowState = FormWindowState.Maximized;
                            }
                        }
                    }
                }

                if (found == false)
                {
                    MessageBox.Show(GlobalSetting.ResManager.GetString("FormNotFound"), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    private void ToolStripDropDownButton1_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
    {
        if (e.ClickedItem is ToolStripSeparator)
        {
            return;
        }

        CustomToolStripMenuItem toolStripItem = ((CustomToolStripMenuItem)e.ClickedItem);

        toolStripDropDownButton1.Text = toolStripItem.Text;

        ResetAll();

        if (toolStripItem.Index == 0)
        {
            SetLastGroupValues("", true);
            deleteToolStripButton.Enabled = false;
        }
        else
        {
            string xml = SavedSearchesHandler.Load(toolStripItem.Text, _registryName);
            LoadSavedSearch(xml);
        }

        _selectedSavedSearchIndex = toolStripItem.Index;

        if (toolStripItem.Text == _defaultSavedSearch)
        {
            defaultToolStripButton.Image = Resources.star;
        }
        else
        {
            defaultToolStripButton.Image = Resources.star1;
        }
    }
예제 #3
0
    public Form1()
    {
        InitializeComponent();

        CustomToolStripMenuItem itemPrimary1 = new CustomToolStripMenuItem("item primary 1");

        itemPrimary1.SecondaryContextMenu = new ContextMenuStrip();
        itemPrimary1.SecondaryContextMenu.Items.AddRange(new ToolStripMenuItem[] {
            new ToolStripMenuItem("item primary 1.1"),
            new ToolStripMenuItem("item primary 1.2"),
        });
        CustomToolStripMenuItem itemPrimary2 = new CustomToolStripMenuItem("item primary 2");

        itemPrimary2.DropDownItems.Add("item primary 2, sub 1");
        itemPrimary2.DropDownItems.Add("item primary 2, sub 2");
        itemPrimary2.SecondaryContextMenu = new ContextMenuStrip();
        itemPrimary2.SecondaryContextMenu.Items.AddRange(new ToolStripMenuItem[] {
            new ToolStripMenuItem("item primary 2.1"),
            new ToolStripMenuItem("item primary 2.2"),
        });
        CustomContextMenuStrip primaryContextMenu = new CustomContextMenuStrip();

        primaryContextMenu.Items.AddRange(new ToolStripItem[] {
            itemPrimary1,
            itemPrimary2
        });
        this.ContextMenuStrip = primaryContextMenu;
    }
예제 #4
0
        private void InitializeMainMenu()
        {
            try
            {
                //Get role categories
                IEnumerable <string> categoriesList = GlobalSetting.FunctionalityRoleService.GetFunctionalitiesCategoriesRole(GlobalSetting.LoggedUser.RoleId);
                //Get role menu list
                IEnumerable <FunctionalityRole> menuList = GlobalSetting.FunctionalityRoleService.GetFunctionalitiesRole(GlobalSetting.LoggedUser.RoleId);

                foreach (string category in categoriesList)
                {
                    var MnuStripItem = new ToolStripMenuItem(category);
                    msMainMenu.Items.Add(MnuStripItem);

                    var categoryMenu = menuList.Where(m => m.Functionality.Category.Equals(category));

                    foreach (FunctionalityRole submenu in categoryMenu)
                    {
                        CustomToolStripMenuItem SSMenu = new CustomToolStripMenuItem(submenu.Functionality.FunctionalityName, null, ChildClick, null);
                        SSMenu.FormName = submenu.Functionality.FormName;  //"Form1";
                        MnuStripItem.DropDownItems.Add(SSMenu);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #5
0
 public CustomComboBox()
 {
     this.SetStyle(ControlStyles.ResizeRedraw, true);
     this.SetStyle(ControlStyles.Selectable, true);
     this.SetStyle(ControlStyles.UserMouse, true);
     this.SetStyle(ControlStyles.UserPaint, true);
     this.SuspendLayout();
     this.ResumeLayout(false);
     _popupControl              = new CustomContextMenuStrip();
     _popupControl.BackColor    = this.BackColor;
     _popupControl.Closed      += new ToolStripDropDownClosedEventHandler(PopupControl_Closed);
     _popupControl.ItemClicked += new ToolStripItemClickedEventHandler(PopupControl_ItemClicked);
     this.Width              = DEFAULT_WIDTH;
     this.Height             = DEFAULT_HEIGHT;
     _selectedItem           = null;
     _bDroppedDown           = false;
     this.BackColor          = SystemColors.Control;
     this.ForeColor          = SystemColors.ControlText;
     _borderColour           = SystemColors.ActiveBorder;
     _dropDownButtonColour   = SystemColors.ButtonFace;
     _droppedDownArrowColour = SystemColors.ControlLight;
     _closedArrowColour      = SystemColors.ControlDark;
     //Set these via the properties so they take effect on _popupControl
     this.DropDownBackColour   = SystemColors.Control;
     this.DropDownForeColour   = SystemColors.ControlText;
     this.DropDownBorderColour = SystemColors.ActiveBorder;
 }
예제 #6
0
 public void SelectFirstItem()
 {
     if (this.Items != null && this.Items.Count > 0)
     {
         _selectedItem = (CustomToolStripMenuItem)this.Items[0];
         OnSelectedItemChanged(EventArgs.Empty);
     }
 }
예제 #7
0
        private bool ShowSecondaryContextMenu(MouseEventArgs e)
        {
            CustomToolStripMenuItem ctsm = this.GetItemAt(e.Location) as CustomToolStripMenuItem;

            if (ctsm == null || ctsm.SecondaryContextMenu == null || e.Button != MouseButtons.Right)
            {
                return(false);
            }
            lastShownSecondaryContextMenu     = ctsm.SecondaryContextMenu;
            secondaryContextMenuActive        = true;
            ctsm.SecondaryContextMenu.Closed += new ToolStripDropDownClosedEventHandler(SecondaryContextMenu_Closed);
            ctsm.SecondaryContextMenu.Show(Cursor.Position);
            return(true);
        }
    private void PopulateSavedSearchesToolStrip()
    {
        toolStripDropDownButton1.DropDown.Items.Clear();

        string emptyText = "Empty";

        if (ConfigHandler.UseTranslation)
        {
            emptyText = Translator.GetText("Empty");
        }

        toolStripDropDownButton1.Text = emptyText;

        CustomToolStripMenuItem toolStripItem = new CustomToolStripMenuItem();

        toolStripItem.Text  = emptyText;
        toolStripItem.Index = 0;

        if (toolStripItem.Text == _defaultSavedSearch)
        {
            toolStripItem.Image = Resources.star;
        }

        toolStripDropDownButton1.DropDownItems.Add(toolStripItem);

        List <string> savedSearchesNames = SavedSearchesHandler.GetNames(_registryName);

        if (savedSearchesNames.Count > 0)
        {
            toolStripDropDownButton1.DropDown.Items.Add(new ToolStripSeparator());
        }

        for (int i = 0; i < savedSearchesNames.Count; i++)
        {
            toolStripItem       = new CustomToolStripMenuItem();
            toolStripItem.Text  = savedSearchesNames[i];
            toolStripItem.Index = i + 1;

            if (toolStripItem.Text == _defaultSavedSearch)
            {
                toolStripItem.Image = Resources.star;
            }

            toolStripDropDownButton1.DropDownItems.Add(toolStripItem);
        }
    }
예제 #9
0
        public Custom3DToolbar( )
        {
            Items.Add(new DesignToolStripButton(ToolStripMenuProperties.Instance.Create3DVolumeToolStripButton));
            Items.Add(new DesignToolStripButton(ToolStripMenuProperties.Instance.SingleCutPlaneToolStripMenuItem));
            Items.Add(new DesignToolStripButton(ToolStripMenuProperties.Instance.DoubleCutPlaneToolStripMenuItem));
            Items.Add(new DesignToolStripButton(ToolStripMenuProperties.Instance.Rotate3DToolStripButton));

            Object3DTypeToolStripSplitButton = new CustomToolStripSplitButton(ToolStripMenuProperties.Instance.Object3DTypeToolStripSplitButton);
            MPRToolStripMenuItem             = new CustomToolStripMenuItem(ToolStripMenuProperties.Instance.MPRToolStripMenuItem);
            MIPToolStripMenuItem             = new CustomToolStripMenuItem(ToolStripMenuProperties.Instance.MIPToolStripMenuItem);
            MinMIPToolStripMenuItem          = new CustomToolStripMenuItem(ToolStripMenuProperties.Instance.MinMIPToolStripMenuItem);
            SSDToolStripMenuItem             = new CustomToolStripMenuItem(ToolStripMenuProperties.Instance.SSDToolStripMenuItem);
            VRTToolStripMenuItem             = new CustomToolStripMenuItem(ToolStripMenuProperties.Instance.VRTToolStripMenuItem);

            Object3DTypeToolStripSplitButton.DropDownItems.AddRange(new ToolStripItem[] { MPRToolStripMenuItem,
                                                                                          MIPToolStripMenuItem,
                                                                                          MinMIPToolStripMenuItem,
                                                                                          SSDToolStripMenuItem,
                                                                                          VRTToolStripMenuItem });

            Items.Add(Object3DTypeToolStripSplitButton);
        }
예제 #10
0
    private void ToolStripDropDownButton1_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
    {
        if (e.ClickedItem is ToolStripSeparator)
        {
            return;
        }

        CustomToolStripMenuItem toolStripItem = ((CustomToolStripMenuItem)e.ClickedItem);

        toolStripDropDownButton1.Text = toolStripItem.Text;

        if (toolStripItem.Index == 0)
        {
            filter1ContentUserControl1.FillDefaultTraceDataValues();
            filter1ContentUserControl1.DisableAllCheckBoxes();
            deleteToolStripButton.Enabled = false;
        }
        else
        {
            string xml = SavedSearchesHandler.Load(toolStripItem.Text, _registryName);
            filter1ContentUserControl1.LoadSavedSearch(xml);

            if (xml != "")
            {
                deleteToolStripButton.Enabled = true;
            }
        }

        _selectedSavedSearchIndex = toolStripItem.Index;

        if (toolStripItem.Text == _defaultSavedSearch)
        {
            defaultToolStripButton.Image = Resources.star;
        }
        else
        {
            defaultToolStripButton.Image = Resources.star1;
        }
    }
예제 #11
0
        public vStripsPlugin()
        {
            // Get IP address of vStrips host from config
            IPAddress ip;

            if (IPAddress.TryParse(Properties.Settings.Default.vStripsHost, out ip))
            {
                vStripsConnector.HostIP = ip;
            }
            else
            {
                vStripsConnector.HostIP = IPAddress.Loopback;
                Properties.Settings.Default.vStripsHost = IPAddress.Loopback.ToString();
            }

            vStripsConnector.Start();
            setupWindowMenu             = new CustomToolStripMenuItem(CustomToolStripMenuItemWindowType.Main, CustomToolStripMenuItemCategory.Settings, new ToolStripMenuItem("vStrips INTAS"));
            setupWindowMenu.Item.Click += SetupWindowMenu_Click;
            MMI.AddCustomMenuItem(setupWindowMenu);

            MMI.SelectedTrackChanged += MMI_SelectedTrackChanged;                                           // Subscribe to Selected Track change event JMG
        }
예제 #12
0
        private void AddCustomMenuItem
        (
            MedicalViewerActionType action,
            WorkstationMenuProperties newMenuProperties,
            ToolStripDropDownItem item
        )
        {
            CustomToolStripMenuItem newActionItem;



            newActionItem = new CustomToolStripMenuItem(newMenuProperties);


            item.DropDownItems.Insert(0, newActionItem);

            ViewerContainer.State.ActiveWorkstation.AddToolbarSplitButtonChildItemLeftAction((CustomToolStripSplitButton)item,
                                                                                             newActionItem,
                                                                                             action);

            ViewerContainer.StripItemFeatureExecuter.SetItemFeature(newActionItem);
        }
예제 #13
0
        protected override void OnMouseWheel(MouseEventArgs e)
        {
            int nIndex = this.Items.IndexOf(_selectedItem);

            if (e.Delta < 0)
            {
                if (nIndex < (this.Items.Count - 1))
                {
                    _selectedItem = (CustomToolStripMenuItem)this.Items[nIndex + 1];
                    OnSelectedItemChanged(EventArgs.Empty);
                    this.Invalidate();
                }
            }
            else if (e.Delta > 0)
            {
                if (nIndex > 0)
                {
                    _selectedItem = (CustomToolStripMenuItem)this.Items[nIndex - 1];
                    OnSelectedItemChanged(EventArgs.Empty);
                    this.Invalidate();
                }
            }
            base.OnMouseWheel(e);
        }
예제 #14
0
 private void PopupControl_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
 {
     _selectedItem = (CustomToolStripMenuItem)e.ClickedItem;
     OnSelectedItemChanged(EventArgs.Empty);
 }