예제 #1
0
        //*************************************************************************
        //  Constructor: NodeXLControl()
        //
        /// <summary>
        /// Initializes a new instance of the <see cref="NodeXLControl" /> class.
        /// </summary>
        //*************************************************************************
        public NodeXLControl()
        {
            m_oGraph = new Graph();
            m_oGraphDrawer = new GraphDrawer(this);

            m_oAsyncLayout = new FruchtermanReingoldLayout();
            OnNewLayout(m_oAsyncLayout);

            m_oLastLayoutContext =
            new LayoutContext(System.Drawing.Rectangle.Empty);

            m_oLastGraphDrawingContext = null;

            m_eLayoutState = LayoutState.Stable;

            m_eMouseMode = MouseMode.Select;
            m_bMouseAlsoSelectsIncidentEdges = true;
            m_bAllowVertexDrag = true;

            m_oVerticesBeingDragged = null;
            m_oMarqueeBeingDragged = null;
            m_oTranslationBeingDragged = null;

            m_oSelectedVertices = new HashSet<IVertex>();
            m_oSelectedEdges = new HashSet<IEdge>();
            m_oCollapsedGroups = new Dictionary<String, IVertex>();
            m_oDoubleClickedVertexInfo = null;

            m_bShowVertexToolTips = false;
            m_oLastMouseMoveLocation = new Point(-1, -1);

            // Create a helper object for displaying vertex tooltips.

            CreateVertexToolTipTracker();
            m_oVertexToolTip = null;

            m_bGraphZoomCentered = false;

            this.AddLogicalChild(m_oGraphDrawer.VisualCollection);

            CreateTransforms();

            // Prevent a focus rectangle from being drawn around the control when
            // it captures keyboard focus.  The focus rectangle does not behave
            // properly when the layout and render transforms are applied --
            // sometimes the rectangle disappears, and sometimes it gets magnified
            // by the render layout.

            this.FocusVisualStyle = null;

            // AssertValid();
        }
예제 #2
0
        //*************************************************************************
        //  Method: StartTranslationDrag()
        //
        /// <summary>
        /// Starts a translation drag operation.
        /// </summary>
        ///
        /// <param name="oMouseLocation">
        /// Mouse location, relative to the control.
        /// </param>
        //*************************************************************************
        protected void StartTranslationDrag(
            Point oMouseLocation
            )
        {
            AssertValid();

            // Save the mouse location for use within the MouseMove event.

            TranslateTransform oTranslateTransform =
            this.TranslateTransformForRender;

            m_oTranslationBeingDragged = new DraggedTranslation(oMouseLocation,
            this.PointToScreen(oMouseLocation), oTranslateTransform.X,
            oTranslateTransform.Y);

            this.Cursor = Cursors.Hand;
            Mouse.Capture(this);
        }
예제 #3
0
        //*************************************************************************
        //  Method: CheckForTranslationDragOnMouseUp()
        //
        /// <summary>
        /// Checks for a translation drag operation during the MouseUp event.
        /// </summary>
        ///
        /// <param name="oMouseEventArgs">
        /// Standard mouse event arguments.
        /// </param>
        //*************************************************************************
        protected void CheckForTranslationDragOnMouseUp(
            MouseEventArgs oMouseEventArgs
            )
        {
            Debug.Assert(oMouseEventArgs != null);
            AssertValid();

            // (Nothing further needs to be done for a translation drag on mouse
            // up.)

            m_oTranslationBeingDragged = null;
        }