Smrf.NodeXL.Visualization.Wpf.MouseDrag.OnMouseMove C# (CSharp) Method

OnMouseMove() public method

public OnMouseMove ( Point currentMouseLocation ) : System.Boolean
currentMouseLocation Point
return System.Boolean
    OnMouseMove
    (
        Point currentMouseLocation
    )
    {
        AssertValid();

        // Once a drag operation starts, it continues until the mouse button is
        // released.

        if (!m_bDragIsInProgress)
        {
            Point oOldLocation = this.MouseDownLocation;
            Double dOldLocationX = oOldLocation.X;
            Double dOldLocationY = oOldLocation.Y;

            Double dCurrentLocationX = currentMouseLocation.X;
            Double dCurrentLocationY = currentMouseLocation.Y;

            if (
                Math.Abs(dCurrentLocationX - dOldLocationX) >= MinimumMouseMove
                ||
                Math.Abs(dCurrentLocationY - dOldLocationY) >= MinimumMouseMove
                )
            {
                m_bDragIsInProgress = true;
            }
        }

        return (m_bDragIsInProgress);
    }

Usage Example

Ejemplo n.º 1
0
    DragIsInProgress
    (
        MouseDrag oMouseDrag,
        MouseEventArgs oMouseEventArgs,
        MouseButtonState [] aeMouseButtonStates,
        out Point oMouseLocation
    )
    {
        Debug.Assert(oMouseEventArgs != null);
        Debug.Assert(aeMouseButtonStates != null);
        Debug.Assert(aeMouseButtonStates.Length > 0);
        AssertValid();

        oMouseLocation = new Point();

        if (oMouseDrag != null)
        {
            foreach (MouseButtonState eMouseButtonState in aeMouseButtonStates)
            {
                if (eMouseButtonState == MouseButtonState.Pressed)
                {
                    oMouseLocation = oMouseEventArgs.GetPosition(this);

                    return ( oMouseDrag.OnMouseMove(oMouseLocation) );
                }
            }
        }

        return (false);
    }