Exemplo n.º 1
0
        protected virtual void InternalBuildContextMenu()
        {
            DBImageAspectMenuItem item;

            // Capture...
            item             = new DBImageAspectMenuItem(this, false, true);
            item.Text        = Strings.Get("DBImageAspect.Menu.CaptureText");
            item.Click      += new EventHandler(CaptureClicked);
            item.DefaultItem = true;
            ContextMenu.MenuItems.Add(item);

            // -
            ContextMenu.MenuItems.Add(new MenuItem("-"));

            //  Load...
            item        = new DBImageAspectMenuItem(this, false, true);
            item.Text   = Strings.Get("DBImageAspect.Menu.LoadText");
            item.Click += new EventHandler(LoadClicked);
            ContextMenu.MenuItems.Add(item);

            // Save As...
            item        = new DBImageAspectMenuItem(this, true, false);
            item.Text   = Strings.Get("DBImageAspect.Menu.SaveAsText");
            item.Click += new EventHandler(SaveAsClicked);
            ContextMenu.MenuItems.Add(item);

            // -
            ContextMenu.MenuItems.Add(new MenuItem("-"));

            // Copy
            item          = new DBImageAspectMenuItem(this, true, false);
            item.Text     = Strings.Get("DBImageAspect.Menu.CopyText");
            item.Click   += new EventHandler(CopyClicked);
            item.Shortcut = Shortcut.CtrlC;
            ContextMenu.MenuItems.Add(item);

            // Paste
            item          = new DBImageAspectMenuItem(this, false, true);
            item.Text     = Strings.Get("DBImageAspect.Menu.PasteText");
            item.Click   += new EventHandler(PasteClicked);
            item.Shortcut = Shortcut.CtrlV;
            ContextMenu.MenuItems.Add(item);

            // Clear
            item        = new DBImageAspectMenuItem(this, true, false);
            item.Text   = Strings.Get("DBImageAspect.Menu.ClearText");
            item.Click += new EventHandler(ClearClicked);
            ContextMenu.MenuItems.Add(item);

            if (OnBuildContextMenu != null)
            {
                OnBuildContextMenu(this, EventArgs.Empty);
            }
        }
Exemplo n.º 2
0
        private void UpdateMenuItems()
        {
            if (ContextMenu != null)
            {
                foreach (MenuItem item in ContextMenu.MenuItems)
                {
                    DBImageAspectMenuItem fileItem = item as DBImageAspectMenuItem;
                    if (fileItem != null)
                    {
                        fileItem.UpdateEnabled();
                    }
                }

                if (OnUpdateMenuItems != null)
                {
                    OnUpdateMenuItems(this, EventArgs.Empty);
                }
            }
        }