ResizeThumb CreateRotateThumb()
        {
            ResizeThumb rotateThumb = new RotateThumb();

            rotateThumb.Cursor    = Cursors.Hand;
            rotateThumb.Cursor    = ZoomControl.GetCursor("Images/rotate.cur");
            rotateThumb.Alignment = PlacementAlignment.Top;
            AdornerPanel.SetPlacement(rotateThumb,
                                      new RelativePlacement(HorizontalAlignment.Center, VerticalAlignment.Top)
            {
                WidthRelativeToContentWidth = 1, HeightOffset = 0
            });
            adornerPanel.Children.Add(rotateThumb);

            DragListener drag = new DragListener(rotateThumb);

            drag.Started += drag_Rotate_Started;
            drag.Changed += drag_Rotate_Changed;
            return(rotateThumb);
        }
        public DragResizeRotateManipulator(IDocumentView view, FrameworkElement el)
            : base(view, el)
        {
            rotateTopLeft     = new RotateThumb(view, el);
            rotateBottomLeft  = new RotateThumb(view, el);
            rotateTopRight    = new RotateThumb(view, el);
            rotateBottomRight = new RotateThumb(view, el);
            resizeTopLeft     = new ResizeThumb(view, el);
            resizeBottomLeft  = new ResizeThumb(view, el);
            resizeTopRight    = new ResizeThumb(view, el);
            resizeBottomRight = new ResizeThumb(view, el);
            resizeLeft        = new ResizeThumb(view, el);
            resizeRight       = new ResizeThumb(view, el);
            resizeTop         = new ResizeThumb(view, el);
            resizeBottom      = new ResizeThumb(view, el);



            dragControl.VerticalAlignment   = VerticalAlignment.Stretch;
            dragControl.HorizontalAlignment = HorizontalAlignment.Stretch;
            dragControl.StrokeThickness     = 1;
            dragControl.Stroke = System.Windows.Media.Brushes.Black;
            dragControl.Cursor = Cursors.SizeAll;
            visualChildren.Add(dragControl);


            rotateTopLeft.VerticalAlignment   = VerticalAlignment.Top;
            rotateTopLeft.HorizontalAlignment = HorizontalAlignment.Left;
            visualChildren.Add(rotateTopLeft);


            rotateBottomLeft.VerticalAlignment   = VerticalAlignment.Bottom;
            rotateBottomLeft.HorizontalAlignment = HorizontalAlignment.Left;
            visualChildren.Add(rotateBottomLeft);


            rotateTopRight.VerticalAlignment   = VerticalAlignment.Top;
            rotateTopRight.HorizontalAlignment = HorizontalAlignment.Right;
            visualChildren.Add(rotateTopRight);


            rotateBottomRight.VerticalAlignment   = VerticalAlignment.Bottom;
            rotateBottomRight.HorizontalAlignment = HorizontalAlignment.Right;
            visualChildren.Add(rotateBottomRight);

            resizeTopLeft.Cursor              = Cursors.SizeNWSE;
            resizeTopLeft.VerticalAlignment   = VerticalAlignment.Top;
            resizeTopLeft.HorizontalAlignment = HorizontalAlignment.Left;
            visualChildren.Add(resizeTopLeft);

            resizeBottomLeft.Cursor              = Cursors.SizeNESW;
            resizeBottomLeft.VerticalAlignment   = VerticalAlignment.Bottom;
            resizeBottomLeft.HorizontalAlignment = HorizontalAlignment.Left;
            visualChildren.Add(resizeBottomLeft);

            resizeTopRight.Cursor              = Cursors.SizeNESW;
            resizeTopRight.VerticalAlignment   = VerticalAlignment.Top;
            resizeTopRight.HorizontalAlignment = HorizontalAlignment.Right;
            visualChildren.Add(resizeTopRight);

            resizeBottomRight.Cursor              = Cursors.SizeNWSE;
            resizeBottomRight.VerticalAlignment   = VerticalAlignment.Bottom;
            resizeBottomRight.HorizontalAlignment = HorizontalAlignment.Right;
            visualChildren.Add(resizeBottomRight);

            resizeLeft.Cursor = Cursors.SizeWE;
            resizeLeft.HorizontalAlignment = HorizontalAlignment.Left;
            resizeLeft.VerticalAlignment   = VerticalAlignment.Center;
            visualChildren.Add(resizeLeft);

            resizeRight.Cursor = Cursors.SizeWE;
            resizeRight.HorizontalAlignment = HorizontalAlignment.Right;
            resizeRight.VerticalAlignment   = VerticalAlignment.Center;
            visualChildren.Add(resizeRight);

            resizeTop.Cursor = Cursors.SizeNS;
            resizeTop.HorizontalAlignment = HorizontalAlignment.Center;
            resizeTop.VerticalAlignment   = VerticalAlignment.Top;
            visualChildren.Add(resizeTop);

            resizeBottom.Cursor = Cursors.SizeNS;
            resizeBottom.HorizontalAlignment = HorizontalAlignment.Center;
            resizeBottom.VerticalAlignment   = VerticalAlignment.Bottom;
            visualChildren.Add(resizeBottom);
        }