Beispiel #1
0
 void automation_OnShowContextMenu(object sender, AnnAutomationEventArgs e)
 {
     if (e != null && e.Object != null)
     {
         _imageViewer.AutomationInvalidate(LeadRectD.Empty);
         AnnAutomationObject annAutomationObject = e.Object as AnnAutomationObject;
         if (annAutomationObject != null)
         {
             ObjectContextMenu menu = annAutomationObject.ContextMenu as ObjectContextMenu;
             if (menu != null)
             {
                 menu.Automation = sender as AnnAutomation;
                 menu.Show(this, _imageViewer.PointToClient(Cursor.Position));
             }
         }
     }
     else
     {
         ManagerContextMenu defaultMenu = new ManagerContextMenu();
         defaultMenu.Automation = sender as AnnAutomation;
         defaultMenu.Show(this, _imageViewer.PointToClient(Cursor.Position));
     }
 }
Beispiel #2
0
        void automation_OnShowContextMenu(object sender, AnnAutomationEventArgs e)
        {
            AnnObject annEditObject = _automation.CurrentEditObject;

            if (e != null)
            {
                AnnAutomationObject annAutomationObject = e.Object;
                if (annAutomationObject != null)
                {
                    _imageViewer.AutomationInvalidate(LeadRectD.Empty);

                    ContextMenu contextMenu = annAutomationObject.ContextMenu as ContextMenu;
                    if (annAutomationObject != null && contextMenu != null)
                    {
                        ObjectContextMenu menu  = annAutomationObject.ContextMenu as ObjectContextMenu;
                        AnnLayer          layer = annEditObject.Layer;
                        if (menu != null)
                        {
                            if (layer != null && !layer.IsVisible)
                            {
                                return;
                            }

                            menu.Automation = sender as AnnAutomation;
                            contextMenu.Show(this, _imageViewer.PointToClient(Cursor.Position));
                        }
                    }
                }
            }
            else
            {
                ManagerContextMenu defaultMenu = new ManagerContextMenu();
                defaultMenu.Automation = sender as AnnAutomation;
                defaultMenu.Show(this, _imageViewer.PointToClient(Cursor.Position));
            }
        }