Пример #1
0
        private void m_oNodeXLControl_GraphMouseUp(
            object sender,
            GraphMouseButtonEventArgs graphMouseButtonEventArgs
            )
        {
            IVertex oClickedVertex = graphMouseButtonEventArgs.Vertex;

            if (oClickedVertex == null)
            {
            AddToStatus("GraphMouseUp: No vertex.");
            }
            else
            {
            AddToStatus("GraphMouseUp: " + oClickedVertex);
            }
        }
Пример #2
0
        //*************************************************************************
        //  Method: oNodeXLControl_GraphMouseUp()
        //
        /// <summary>
        /// Handles the GraphMouseUp event on the oNodeXLControl control.
        /// </summary>
        ///
        /// <param name="sender">
        /// Standard event argument.
        /// </param>
        ///
        /// <param name="e">
        /// Standard event argument.
        /// </param>
        //*************************************************************************
        private void oNodeXLControl_GraphMouseUp(
            object sender,
            GraphMouseButtonEventArgs e
            )
        {
            AssertValid();

            // A m_iEnableGraphControlsCount value of zero or greater should enable
            // the controls used to interact with the graph.

            if (m_iEnableGraphControlsCount < 0 ||
            e.ChangedButton != MouseButton.Right)
            {
            return;
            }

            // Enable the controls on the context menu, then display it at the
            // clicked location.

            EnableContextMenuItems(e.Vertex);

            cmsNodeXLControl.Show( WpfGraphicsUtil.WpfPointToPoint(
            oNodeXLControl.PointToScreen(
                e.GetPosition(oNodeXLControl) ) ) );

            // It shouldn't be necessary to give focus to the context menu, but if
            // this isn't done, the following bug occurs: Run the ExcelTemplate
            // project on a Vista or XP machine.  Detach the graph pane (Excel's
            // Document Actions pane) from the Excel window and right-click the
            // NodeXLControl.  A context menu pops up, but it behaves erratically:
            // if you click a menu item that has a submenu, the submenu doesn't
            // appear.  Instead, focus is given back to the Excel workbook, which
            // flashes a cell in an odd manner.
            //
            // This bug does not occur if the graph pane is not detached from the
            // Excel window.

            cmsNodeXLControl.Focus();
        }