示例#1
0
        /// <summary>
        /// Begins dragging any selected items managed by the adapter. May be called
        /// by another adapter when it begins dragging.</summary>
        /// <param name="initiator">Control adapter that is initiating the drag</param>
        void IItemDragAdapter.BeginDrag(ControlAdapter initiator)
        {
            // drag all selected annotations
            m_annotationSet = new HashSet <IAnnotation>();
            List <IAnnotation> draggingAnnotations = new List <IAnnotation>();

            foreach (IAnnotation annotation in m_selectionContext.GetSelection <IAnnotation>())
            {
                draggingAnnotations.Add(annotation);
                m_annotationSet.Add(annotation);
            }

            m_draggingAnnotations = draggingAnnotations.ToArray();
            m_newPositions        = new Point[m_draggingAnnotations.Length];
            m_oldPositions        = new Point[m_draggingAnnotations.Length];
            for (int i = 0; i < m_draggingAnnotations.Length; i++)
            {
                // Initialize m_newPositions in case the mouse up event occurs before
                //  a paint event, which can happen during rapid clicking.
                Point currentLocation = m_draggingAnnotations[i].Bounds.Location;
                m_newPositions[i] = currentLocation;
                m_oldPositions[i] = currentLocation;
            }
        }
示例#2
0
        /// <summary>
        /// Begins dragging any selected items managed by the adapter. May be called
        /// by another adapter when it begins dragging.</summary>
        /// <param name="initiator">Control adapter that is initiating the drag</param>
        void IItemDragAdapter.BeginDrag(ControlAdapter initiator)
        {
            // drag all selected annotations
            m_annotationSet = new HashSet<IAnnotation>();
            List<IAnnotation> draggingAnnotations = new List<IAnnotation>();
            foreach (IAnnotation annotation in m_selectionContext.GetSelection<IAnnotation>())
            {
                draggingAnnotations.Add(annotation);
                m_annotationSet.Add(annotation);
            }

            m_draggingAnnotations = draggingAnnotations.ToArray();
            m_newPositions = new Point[m_draggingAnnotations.Length];
            m_oldPositions = new Point[m_draggingAnnotations.Length];
            for (int i = 0; i < m_draggingAnnotations.Length; i++)
            {
                // Initialize m_newPositions in case the mouse up event occurs before
                //  a paint event, which can happen during rapid clicking.
                Point currentLocation = m_draggingAnnotations[i].Bounds.Location;
                m_newPositions[i] = currentLocation;
                m_oldPositions[i] = currentLocation;
            }
        }
示例#3
0
        //void IPrintingAdapter.Print(PrintDocument printDocument, Graphics g)
        //{
        //    switch (printDocument.PrinterSettings.PrintRange)
        //    {
        //        case PrintRange.Selection:
        //            PrintSelection(g);
        //            break;

        //        default:
        //            PrintAll(g);
        //            break;
        //    }
        //}

        //private void PrintSelection(D2dGraphics g)
        //{
        //    if (m_selectionContext != null)
        //    {
        //        foreach (IAnnotation annotation in m_selectionContext.GetSelection<IAnnotation>())
        //            DrawAnnotation(annotation, DiagramDrawingStyle.Normal, g);
        //    }
        //}

        //private void PrintAll(D2dGraphics g)
        //{
        //    foreach (IAnnotation annotation in m_annotatedDiagram.Annotations)
        //        DrawAnnotation(annotation, DiagramDrawingStyle.Normal, g);
        //}

        #endregion

        #region IItemDragAdapter Members

        void IItemDragAdapter.BeginDrag(ControlAdapter initiator)
        {
            m_draggingAnnotations = m_selectionContext.GetSelection<IAnnotation>().ToArray();
            m_moving = true;

            m_newPositions = new Point[m_draggingAnnotations.Length];
            m_oldPositions = new Point[m_draggingAnnotations.Length];
            for (int i = 0; i < m_draggingAnnotations.Length; i++)
            {
                // Initialize m_newPositions in case the mouse up event occurs before
                //  a paint event, which can happen during rapid clicking.
                Point currentLocation = m_draggingAnnotations[i].Bounds.Location;
                m_newPositions[i] = currentLocation;
                m_oldPositions[i] = currentLocation;
            }

            if (m_autoTranslateAdapter != null)
                m_autoTranslateAdapter.Enabled = true;
        }
示例#4
0
 /// <summary>
 /// Begins dragging any selected items managed by the adapter. May be called
 /// by another adapter when it begins dragging.</summary>
 /// <param name="initiator">Control adapter that is initiating the drag</param>
 void IItemDragAdapter.BeginDrag(ControlAdapter initiator)
 {
 }
示例#5
0
 /// <summary>
 /// Begins dragging any selected items managed by the adapter. May be called
 /// by another adapter when it begins dragging.</summary>
 /// <param name="initiator">Control adapter that is initiating the drag</param>
 void IItemDragAdapter.BeginDrag(ControlAdapter initiator)
 {
 }